Glibc issue, was: Trying to include floating point trapping in fortran program

Toon Moene toon@moene.indiv.nluug.nl
Tue Sep 19 13:08:00 GMT 2000


Duncan Galloway wrote:

> I'm trying to compile a program and include the c code listed in the
> document
> 
>         http://gcc.gnu.org/onlinedocs/g77_20.html#SEC604
> 
> This is supposed to trap floating point errors, overflows, underflows
> etc. I used this once before and it worked fine, but I'm getting
> problems now. Below is what I'm doing.
> 
> > cat nan.c
> #include <fpu_control.h>
> static void __attribute__ ((constructor))
> trapfpe ()
> {
>   __setfpucw (_FPU_DEFAULT &
>               ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM));
> }

IIRC, this solution only worked with glibc-2.0.x; with glibc-2.1 and
higher you need to do this in a different way.  Unfortunately, I do not
have a glibc-2.1 system handy, so I can't explain how.

Hope someone else on this list can help,

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://g95.sourceforge.net/ (under construction)


More information about the Gcc-bugs mailing list