diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-06 16:52:47 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-06 16:52:47 +0000 |
commit | 4f8f4cb846cfc33c5de37ec80c2ab4209ace7f2a (patch) | |
tree | cae87a5350ed0c4d96974ba136c4cdcae7117138 /gcc/c-family | |
parent | 87351ae8912b4a08209db17300d5b679e55db82f (diff) | |
download | gcc-4f8f4cb846cfc33c5de37ec80c2ab4209ace7f2a.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204460 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-family/c-cppbuiltin.c | 13 | ||||
-rw-r--r-- | gcc/c-family/c-opts.c | 9 |
3 files changed, 24 insertions, 5 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 68929521087..582aa9383d6 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2013-11-06 Joseph Myers <joseph@codesourcery.com> + + * 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. + 2013-11-05 Tobias Burnus <burnus@net-b.de> * c.opt (-Wdate-time): New option diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 61a124c509c..b9a0f18cd7e 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -726,16 +726,19 @@ cpp_iec_559_value (void) ret = 0; /* In strict C standards conformance mode, consider unpredictable - excess precision to mean lack of IEEE 754 support. ??? The same - should apply to unpredictable contraction, but at present - standards conformance options do not enable conforming - contraction. For C++, and outside strict conformance mode, do - not consider these options to mean lack of IEEE 754 support. */ + excess precision to mean lack of IEEE 754 support. The same + applies to unpredictable contraction. For C++, and outside + strict conformance mode, do not consider these options to mean + lack of IEEE 754 support. */ if (flag_iso && !c_dialect_cxx () && TARGET_FLT_EVAL_METHOD != 0 && flag_excess_precision_cmdline != EXCESS_PRECISION_STANDARD) ret = 0; + if (flag_iso + && !c_dialect_cxx () + && flag_fp_contract_mode == FP_CONTRACT_FAST) + ret = 0; /* Various options are contrary to IEEE 754 semantics. */ if (flag_unsafe_math_optimizations diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 2de5425e654..34fe94de34b 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -827,6 +827,15 @@ c_common_post_options (const char **pfilename) ? EXCESS_PRECISION_STANDARD : EXCESS_PRECISION_FAST); + /* 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_fp_contract_mode = FP_CONTRACT_OFF; + /* By default we use C99 inline semantics in GNU99 or C99 mode. C99 inline semantics are not supported in GNU89 or C89 mode. */ if (flag_gnu89_inline == -1) |