[gfortran,patch] -ffpe-trap library support for SysV
Steve Kargl
sgk@troutmask.apl.washington.edu
Thu Oct 13 22:10:00 GMT 2005
On Thu, Oct 13, 2005 at 11:37:57PM +0200, FX Coudert wrote:
> >>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?
>
> Yes, feenableexcept/fedisableexcept are already used in libgfortran when
> available.
>
> As for FreeBSD, I guess they should work on a way to do this, apart from
> assembler :-)
>
FreeBSD has feenableexcept/fedisableexcept. From the fenv(3) manpage
STANDARDS
Except as noted below, <fenv.h> conforms to ISO/IEC 9899:1999
(``ISO C99''). The feenableexcept(), fedisableexcept(), and
fegetexcept() routines are extensions.
HISTORY
The <fenv.h> header first appeared in FreeBSD 5.3. It supersedes the
non-standard routines defined in <ieeefp.h> and documented in
fpgetround(3).
--
Steve
More information about the Gcc-patches
mailing list