Date: Wed, 9 Jun 1999 20:32:58 +0100 From: Mark Ovens <markov@globalnet.co.uk> To: questions@freebsd.org Subject: gcc/egcs trouble passing a double Message-ID: <19990609203258.E261@marder-1>
next in thread | raw e-mail | index | archive | help
I've got a wierd problem with a program I'm working on, trying to
pass a double to a function. The program core dumps with a SIGFPE.
I built a debug version and ran it in gdb to find the cause. A C++
function declared
Datasym *install(const char *s, int t, double d, int stream)
is called (from another C++ file) by
s = install(sbuf, 261, 0.0, q_strm);
In install() the SIGFPE (Arithmetic exception) occurrs at the line
sp->val = d;
Inserting a breakpoint at the start of install() and printing d
shows it to be
8.275783586691418e-313
hence the SIGFPE, it's outside the range of a double, but why?
0.0 was passed in. All the other args are passed correctly.
I've been trying to crack this for a couple of days now, but it's
got me stumped. It's as though too much space is being allocated
for a double.
The only thing I can think of (& I'm guessing here) is that it's
to do with the alignment of doubles and/or the stack and/or the
start of functions on word boundaries. I see that there are several
compiler options for controlling this, -malign-double, -mno-align-double,
-malign-functions, -mpreferred-stack-boundary etc. Is this the cause?
Can anyone suggest where I should start looking for the cause.
Thanks.
--
FreeBSD - The Power To Serve http://www.freebsd.org
My Webpage http://www.users.globalnet.co.uk/~markov
_______________________________________________________________
Mark Ovens, CNC Apps Engineer, Radan Computational Ltd. Bath UK
CAD/CAM solutions for Sheetmetal Working Industry
mailto:marko@uk.radan.com http://www.radan.com
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990609203258.E261>
