This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Glibc issue, was: Trying to include floating point trapping in fortran program
- To: Duncan Galloway <duncan at space dot mit dot edu>
- Subject: Glibc issue, was: Trying to include floating point trapping in fortran program
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Tue, 19 Sep 2000 20:50:17 +0200
- CC: gcc-bugs at gcc dot gnu dot org
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <39C7802C.D8EEE528@space.mit.edu>
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)