gfortran45 IEEE exceptions are in the manual, but not supported?
Anton Shterenlikht
mexas@bristol.ac.uk
Wed Feb 23 12:40:00 GMT 2011
On ia64 FreeBSD 9.0-current:
% cat tmp.f90
program z
implicit none
real(kind=4) :: x,y
x=1.0e-30
y= x*x
write(*,*)y
y= 1.0/x/x
write(*,*)y
end program z
% gfortran45 -ffpe-trap=invalid,zero,overflow,underflow,precision,denormal tmp.f90
This program triggers over- and underflow.
% ./a.out
Fortran runtime warning: IEEE 'invalid operation' exception not supported.
Fortran runtime warning: IEEE 'denormal number' exception not supported.
Fortran runtime warning: IEEE 'division by zero' exception not supported.
Fortran runtime warning: IEEE 'overflow' exception not supported.
Fortran runtime warning: IEEE 'underflow' exception not supported.
Fortran runtime warning: IEEE 'loss of precision' exception not supported.
0.0000000
+Infinity
%
>From the man page:
-ffpe-trap=list
Specify a list of IEEE exceptions when a Floating Point Exception
(FPE) should be raised. On most systems, this will result in a
SIGFPE signal being sent and the program being interrupted,
producing a core file useful for debugging. list is a (possibly
empty) comma-separated list of the following IEEE exceptions:
invalid (invalid floating point operation, such as "SQRT(-1.0)"),
zero (division by zero), overflow (overflow in a floating point
operation), underflow (underflow in a floating point operation),
precision (loss of precision during operation) and denormal
(operation produced a denormal value).
I understand that IEEE fpe are not implemented yet in gfortran.
Should then the reference to -ffpe-trap be removed from
the man page?
Many thanks
Anton
--
Anton Shterenlikht
Room 2.6, Queen's Building
Mech Eng Dept
Bristol University
University Walk, Bristol BS8 1TR, UK
Tel: +44 (0)117 331 5944
Fax: +44 (0)117 929 4423
More information about the Fortran
mailing list