This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Trying to include floating point trapping in fortran program
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Trying to include floating point trapping in fortran program
- From: Duncan Galloway <duncan at space dot mit dot edu>
- Date: Tue, 19 Sep 2000 11:03:08 -0400
- Organization: Center for Space Research, MIT
Hi,
I just downloaded and compiled the latest version of gcc and g77, and
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));
}
> gcc -c nan.c
> g77 -fno-automatic -finit-local-zero nan.o -O column5.f mt19937.f dlib.f K8.f -o column5-3.4+
/nfs/grs1915/h1/duncan/src/nan.o: In function `trapfpe':
/nfs/grs1915/h1/duncan/src/nan.o(.text+0xf): undefined reference to
`__setfpucw'
collect2: ld returned 1 exit status
Any idea what the problem is here? Below is information on the system
I'm using:
> g77 --verbose
g77 version 2.95.2 19991024 (release) (from FSF-g77 version 0.5.25
19991024 (release))
Driving: g77 -v -c -xf77-version /dev/null -xnone
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/cpp -lang-c -v
-D__GNUC__=2 -D__GNUC_MINOR__=95 -D__ELF__ -D__unix__ -D__i386__
-D__linux__ -D__unix -D__linux -Asystem(posix) -D_LANGUAGE_FORTRAN
-traditional -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__
-Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__
/dev/null /dev/null
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../i686-pc-linux-gnu/include
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include
/usr/include
End of search list.
The following default directories have been omitted from the search
path:
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3
End of omitted list.
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/f771 -fnull-version
-quiet -dumpbase g77-version.f -version -fversion -o /tmp/cc6Pcdzs.s
/dev/null
GNU F77 version 2.95.2 19991024 (release) (i686-pc-linux-gnu) compiled
by GNU C version 2.95.2 19991024 (release).
GNU Fortran Front End version 0.5.25 19991024 (release)
as -V -Qy -o /tmp/ccgpuHaP.o /tmp/cc6Pcdzs.s
GNU assembler version 2.9.1 (i386-redhat-linux), using BFD version
2.9.1.0.23
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o /tmp/ccgLfpoe
/tmp/ccgpuHaP.o /usr/lib/crt1.o /usr/lib/crti.o
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/crtbegin.o
-L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2 -L/usr/local/lib -lg2c
-lm -lgcc -lc -lgcc
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/crtend.o /usr/lib/crtn.o
/tmp/ccgLfpoe
__G77_LIBF77_VERSION__: 0.5.25 19991024 (release)
@(#)LIBF77 VERSION 19990503
__G77_LIBI77_VERSION__: 0.5.25 19991024 (release)
@(#) LIBI77 VERSION pjw,dmg-mods 19990503
__G77_LIBU77_VERSION__: 0.5.25 19991024 (release)
@(#) LIBU77 VERSION 19980709
I'd really appreciate any help you can offer.
Cheers
Duncan
--
-------------------------------------------------------------------------
Duncan Galloway Phone: +1 (617) 253-6996
Massachusetts Institute of Technology Fax: +1 (617) 253-0861
37-571, 77 Massachusetts Avenue E-mail: duncan@space.mit.edu
Cambridge, MA 02139 USA URL:www.ozemail.com.au/~outsider