aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2019-10-08 00:37:45 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2019-10-08 00:37:45 +0000
commit07603136be4090e44c89c0000b7a4620b0604614 (patch)
tree24ae9f7f7cca0794b54fdcc58088dce8cb05ac5e
parentd1a2bc9ae5834ca6114aa7c26330a08e20e43bf7 (diff)
Make C2X imply -fno-fp-int-builtin-inexact.
Since TS 18661-1 has been integrated into C2X, this patch makes C2X imply -fno-fp-int-builtin-inexact. Bootstrapped with no regressions on x86_64-pc-linux-gnu. gcc: * doc/invoke.texi (-ffp-int-builtin-inexact): Document -fno-fp-int-builtin-inexact default for C2X. gcc/c-family: * c-opts.c (c_common_post_options): Set -fno-fp-int-builtin-inexact for C2X. gcc/testsuite: * gcc.dg/torture/builtin-fp-int-inexact-c2x.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@276686 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-opts.c6
-rw-r--r--gcc/doc/invoke.texi8
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-fp-int-inexact-c2x.c7
6 files changed, 31 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 51edea9788c..23e0a259e0c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-08 Joseph Myers <joseph@codesourcery.com>
+
+ * doc/invoke.texi (-ffp-int-builtin-inexact): Document
+ -fno-fp-int-builtin-inexact default for C2X.
+
2019-10-07 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Richard Biener <rguenther@suse.de>
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 7deaff065cf..93077ff7c0e 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-08 Joseph Myers <joseph@codesourcery.com>
+
+ * c-opts.c (c_common_post_options): Set
+ -fno-fp-int-builtin-inexact for C2X.
+
2019-10-05 Jakub Jelinek <jakub@redhat.com>
PR c++/91369 - Implement P0784R7: constexpr new
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 949d96a7839..4ad24bd3ea0 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -826,6 +826,12 @@ c_common_post_options (const char **pfilename)
else
flag_permitted_flt_eval_methods = PERMITTED_FLT_EVAL_METHODS_C11;
+ /* C2X Annex F does not permit certain built-in functions to raise
+ "inexact". */
+ if (flag_isoc2x
+ && !global_options_set.x_flag_fp_int_builtin_inexact)
+ flag_fp_int_builtin_inexact = 0;
+
/* 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)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 107793084b2..20e10c01804 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -10809,12 +10809,12 @@ Do not allow the built-in functions @code{ceil}, @code{floor},
double} variants, to generate code that raises the ``inexact''
floating-point exception for noninteger arguments. ISO C99 and C11
allow these functions to raise the ``inexact'' exception, but ISO/IEC
-TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
-functions to do so.
+TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
+ISO C2X, does not allow these functions to do so.
The default is @option{-ffp-int-builtin-inexact}, allowing the
-exception to be raised. This option does nothing unless
-@option{-ftrapping-math} is in effect.
+exception to be raised, unless C2X or a later C standard is selected.
+This option does nothing unless @option{-ftrapping-math} is in effect.
Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
generate a call to a library function then the ``inexact'' exception
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b55e272864a..4555fc87f9f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2019-10-08 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/torture/builtin-fp-int-inexact-c2x.c: New test.
+
2019-10-07 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* gcc.target/msp430/430x-insns.c: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-fp-int-inexact-c2x.c b/gcc/testsuite/gcc.dg/torture/builtin-fp-int-inexact-c2x.c
new file mode 100644
index 00000000000..039cb5392fe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-fp-int-inexact-c2x.c
@@ -0,0 +1,7 @@
+/* Test C2X enables -fno-fp-int-builtin-inexact. */
+/* { dg-do run } */
+/* { dg-options "-std=c2x" } */
+/* { dg-add-options c99_runtime } */
+/* { dg-require-effective-target fenv_exceptions } */
+
+#include "builtin-fp-int-inexact.c"