From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <02bb01c40244$20a2ac20$8201a8c0@cc77109e> From: "Bruce Ellis" To: <9fans@cse.psu.edu> References: <200403042218.i24MIRFI059560@adat.davidashen.net> Subject: Re: [9fans] fp stack overflow -- hypot MIME-Version: 1.0 Content-Type: text/plain; charset="KOI8-R" Content-Transfer-Encoding: 7bit Date: Fri, 5 Mar 2004 10:53:47 +1100 Topicbox-Message-UUID: 15cb78f8-eacd-11e9-9e20-41e7f4b1d025 ok, i've found the problem. take a look in: /386/include/ape/math.h and you'll see that hypot() is not declared unless _RESEARCH_SOURCE is. hence the compiler presumes that the function returns int and picks up AX rather than popping the fp stack. solution: either define _RESEARCH_SOURCE, or if that introduces conflicts then simply copy the prototype from math.h to somewhere visible. it may really be a "faulty", in the posix sense, math.h but i'm avoiding investigating that. brucee ----- Original Message ----- From: "David Tolpin" To: <9fans@cse.psu.edu> Sent: Friday, March 05, 2004 9:18 AM Subject: [9fans] fp stack overflow -- hypot > The offending function is hypot(2). If I replace it with sqrt(p*p+q*q), > no more stack overflows no matter what are shapes and how complex the graph > is. > > I think it is a compiler bug. But need more time or someone's help. > > David