[Bug middle-end/34678] Optimization generates incorrect code with -frounding-math option (#pragma STDC FENV_ACCESS not implemented)

nmm1 at cam dot ac.uk gcc-bugzilla@gcc.gnu.org
Mon Nov 11 09:30:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34678

Nick Maclaren <nmm1 at cam dot ac.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nmm1 at cam dot ac.uk

--- Comment #20 from Nick Maclaren <nmm1 at cam dot ac.uk> ---
Richard Biener's approach to the default is the one that matches the C
standard and Vincent Lefèvre is mistaken.  C11 7.6.1p2 says:

"... If part of a program tests floating-point status flags, sets
floating-point control modes, or runs under non-default mode settings,
but was translated with the state for the FENV_ACCESS pragma ‘‘off’’,
the behavior is undefined.  The default state (‘‘on’’ or ‘‘off’’) for
the pragma is implementation-defined."  Defining it to be 'off' and
not setting __STDC_IEC_559__ is very reasonable.

Because generated code and the library are potentially dependent on the
rounding mode (including even floating point to integer conversion!),
the default should remain that rounding mode support is off until each
target has been thoroughly checked that it does NOT break.

There are also very strong grounds for not wanting IEEE 754 support by
default, anyway, because of the performance impact and because a lot of
programs won't reset the state before calling external functions (and
hence may well give wrong answers).  That is especially true if the code
is used within a C++ program or uses GPUs or some SIMD units - let alone
OpenMP :-(


More information about the Gcc-bugs mailing list