gfortran45 IEEE exceptions are in the manual, but not supported?

Steve Kargl sgk@troutmask.apl.washington.edu
Wed Feb 23 16:58:00 GMT 2011


On Wed, Feb 23, 2011 at 12:40:49PM +0000, Anton Shterenlikht wrote:
> 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

laptop:kargl[205] gfc4x -ffpe-trap=invalid,zero,overflow,underflow,precision,denormal d.f90
laptop:kargl[206] ./a.out 
Floating exception (core dumped)

I get the above with 4.4.6, 4.5.3, and 4.6.0 on x86_64-*-freebsd.
I get the above with 4.6.0 on i686-*-freebsd.
 

> I understand that IEEE fpe are not implemented yet in gfortran.
> Should then the reference to -ffpe-trap be removed from
> the man page?

No.  It seems on your target (ia64 IIRC), exceptions aren't
handled correctly.  Patch is welcomed.

-- 
Steve



More information about the Fortran mailing list