[Bug target/37845] gcc ignores FP_CONTRACT pragma set to OFF
vincent-gcc at vinc17 dot net
gcc-bugzilla@gcc.gnu.org
Fri Aug 14 15:08:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37845
Vincent Lefèvre <vincent-gcc at vinc17 dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
This bug has been fixed by:
r204460 | jsm28 | 2013-11-06 17:52:47 +0100 (Wed, 06 Nov 2013) | 9 lines
Changed paths:
M /trunk/gcc/c-family/ChangeLog
M /trunk/gcc/c-family/c-cppbuiltin.c
M /trunk/gcc/c-family/c-opts.c
M /trunk/gcc/testsuite/ChangeLog
A /trunk/gcc/testsuite/gcc.dg/torture/c99-contract-1.c
c-family:
* c-opts.c (c_common_post_options): Set -ffp-contract=off in C
standards modes.
* c-cppbuiltin.c (cpp_iec_559_value): Consider -ffp-contract=fast
to mean lack of IEEE 754 support.
testsuite:
* gcc.dg/torture/c99-contract-1.c: New test.
gcc/c-family/c-opts.c now contains:
/* ISO C restricts floating-point expression contraction to within
source-language expressions (-ffp-contract=on, currently an alias
for -ffp-contract=off). */
if (flag_iso
&& !c_dialect_cxx ()
&& (global_options_set.x_flag_fp_contract_mode
== (enum fp_contract_mode) 0)
&& flag_unsafe_math_optimizations == 0)
flag_fp_contract_mode = FP_CONTRACT_OFF;
I tested, and this works as expected.
Note: This bug was about FP contraction being done despite the use of:
#pragma STDC FP_CONTRACT OFF
not about the pragma being ignored (the implementation of this pragma is not
required by the ISO C standard if the default is OFF, which is now the case
with GCC). So, this bug is really fixed. A new enhancement bug could be opened
(if not already done) for the implementation of the STDC FP_CONTRACT pragma.
More information about the Gcc-bugs
mailing list