From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <199612161921.OAA18934@rrdjazz.nist.gov> Date: Mon, 16 Dec 1996 14:21:56 -0500 From: Przemek Klosowski Subject: Re: Floating point exception Anyone know why this program causes a floating point exception on the Alpha? #include 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