optimization/576: gcc performs invalid optimization with floatoperations.

Joseph S. Myers jsm28@cam.ac.uk
Thu Sep 28 08:34:00 GMT 2000


On 28 Sep 2000 goualard@cwi.nl wrote:

> gcc performs optimizations that are invalid for some
> floating-point computations when the rounding direction
> is set towards +infinity or -infinity. As shown in
> the code example, trivial identities do no longer hold.

For this to work properly, according to the C99 standard you must use
"#pragma STDC FENV_ACCESS ON".  GCC does not yet support the C99 standard
pragmas, but hopefully it will do so in future.  (Note also that using the
<fenv.h> function fesetround() is more portable than using an asm.)  This
should for now be considered a missing feature in GCC (documented as
missing at http://gcc.gnu.org/c99status.html ).  See
http://gcc.gnu.org/contribute.html and
http://gcc.gnu.org/contributewhy.html if you want to contribute an
implementation; I don't know if anyone is working on this.

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Gcc-bugs mailing list