From: Przemek Klosowski <przemek@rrdjazz.nist.gov>
Subject: Re: Floating point exception
Date: Mon, 16 Dec 1996 14:21:56 -0500 [thread overview]
Message-ID: <199612161921.OAA18934@rrdjazz.nist.gov> (raw)
Anyone know why this program causes a floating point exception on the
Alpha?
#include <float.h>
int main()
{
double a = 4.5;
if(a > DBL_MIN) {
return 1;
}
return 0;
}
Yes, I know why this program crashes with SIGFPE. First, gcc 2.7.2 included
with RedHat 4.0 has a bug where it miscompiles floating point constants. DBL_MIN
is supposed to be the least double that is still normalized; due to the above
bug it is compiled as a slightly smaller denormalized number.
The load of this denormal triggers a denormal exception; the default behavior
of the signal handler is to stop the program.
Richard Henderson has gcc patches that solve the first problem
ftp://ftp.redhat.com/pub/alphabits/rth-gcc-2.7.2-*.diff.gz
As to the second, I don't understand how, but I stopped getting traps for
denormals after compiling gcc with Richard's patches; it looks as if they
changed the code generation to truncate to zero instead of going into
denormal mode, even though I don't see why it should happen after quick
perusal of the patches.
You may also want to try undocumented machine-specific option -mfp-trap-mode=n.
p
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
next reply other threads:[~1996-12-16 19:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-12-16 19:21 Przemek Klosowski [this message]
[not found] <199612152221.RAA06013@churchy.gnu.ai.mit.edu>
1996-12-16 18:44 ` Floating point exception Jerry Feldman
-- strict thread matches above, loose matches on Subject: below --
1996-12-15 22:21 Craig Burley
[not found] <Pine.LNX.3.95.961215124644.26796Q-100000@sexpistols.dontknow.com>
1996-12-15 21:31 ` Paul B. Brown
1996-12-15 22:33 ` David R. McGown
1996-12-16 16:15 ` Richard Henderson
1996-12-15 12:54 Dan McGuirk
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox