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. Applied to mainline. gcc: 2019-10-08 Joseph Myers <jos...@codesourcery.com> * doc/invoke.texi (-ffp-int-builtin-inexact): Document -fno-fp-int-builtin-inexact default for C2X. gcc/c-family: 2019-10-08 Joseph Myers <jos...@codesourcery.com> * c-opts.c (c_common_post_options): Set -fno-fp-int-builtin-inexact for C2X. gcc/testsuite: 2019-10-08 Joseph Myers <jos...@codesourcery.com> * gcc.dg/torture/builtin-fp-int-inexact-c2x.c: New test. Index: gcc/c-family/c-opts.c =================================================================== --- gcc/c-family/c-opts.c (revision 276655) +++ gcc/c-family/c-opts.c (working copy) @@ -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) Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 276655) +++ gcc/doc/invoke.texi (working copy) @@ -10810,12 +10810,12 @@ Do not allow the built-in functions @code{ceil}, @ 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 Index: gcc/testsuite/gcc.dg/torture/builtin-fp-int-inexact-c2x.c =================================================================== --- gcc/testsuite/gcc.dg/torture/builtin-fp-int-inexact-c2x.c (nonexistent) +++ gcc/testsuite/gcc.dg/torture/builtin-fp-int-inexact-c2x.c (working copy) @@ -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" -- Joseph S. Myers jos...@codesourcery.com