[gfortran,patch] -ffpe-trap library support for SysV

Daniel Jacobowitz drow@false.org
Thu Oct 13 21:38:00 GMT 2005


On Thu, Oct 13, 2005 at 07:47:43PM +0200, FX Coudert wrote:
> >OK.  I looked at your patch.  I'll test and review it more formally
> >on Saturday.
> 
> Thanks. It will still enable this functionnality solaris, (open|net)bsd, 
> hpux and irix; that's a lot!
> 
> >>As for fenv (it's already been discussed here), there's no C99 way to
> >>raise FPE on individually selected exceptions.
> >
> >Huh?  feraiseexcept(FE_OVEFLOW) will raise an overflow exception.
> >You can do the same with FE_INVALID, FE_DIVBYZERO, FE_INEXACT, 
> >and FE_UNDERFLOW.
> 
> What I wanted to say is: there's no C99 way to ask for a FPE to be 
> raised on individually selected exceptions. That is, there is no C99 way 
> to do:
> 
>   float x;
>   raise_fpe_on_ieee_exception(EXCEPTION_INVALID);
>   x = -2;
>   x = sqrt(x); // This raises a FPE

FYI (you probably already know this), glibc does offer this
functionality: feenableexcept and fedisableexcept.  If there's really
no C99 way to accomplish the same thing, perhaps FreeBSD should adopt
that?

-- 
Daniel Jacobowitz
CodeSourcery, LLC



More information about the Fortran mailing list