From df375b0321f9a5360fd04435ee5832c253aa4175 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 23 Aug 2019 13:37:29 +0200 Subject: [PATCH] re PR middle-end/91283 (gcc.dg/torture/c99-contract-1.c FAILs) PR middle-end/91283 * common.opt (fexcess-precision=): Add Optimization flag. Use flag_excess_precision variable instead of flag_excess_precision_cmdline. * flags.h (class target_flag_state): Remove x_flag_excess_precision member. (flag_excess_precision): Don't define. * langhooks.c (lhd_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. Remove comment. * opts.c (set_fast_math_flags): Use frontend_set_flag_excess_precision and x_flag_excess_precision instead of frontend_set_flag_excess_precision_cmdline and x_flag_excess_precision_cmdline. (fast_math_flags_set_p): Use x_flag_excess_precision instead of x_flag_excess_precision_cmdline. * toplev.c (init_excess_precision): Remove. (lang_dependent_init_target): Don't call it. ada/ * gcc-interface/misc.c (gnat_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. brig/ * brig-lang.c (brig_langhook_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. c-family/ * c-common.c (c_ts18661_flt_eval_method): Use flag_excess_precision instead of flag_excess_precision_cmdline. * c-cppbuiltin.c (c_cpp_flt_eval_method_iec_559): Likewise. * c-opts.c (c_common_post_options): Likewise. d/ * d-lang.cc (d_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. fortran/ * options.c (gfc_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. Remove comment. go/ * go-lang.c (go_langhook_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. lto/ * lto-lang.c (lto_post_options): Set flag_excess_precision instead of flag_excess_precision_cmdline. Remove comment. From-SVN: r274850 --- gcc/ChangeLog | 20 ++++++++++++++++++++ gcc/ada/ChangeLog | 6 ++++++ gcc/ada/gcc-interface/misc.c | 4 ++-- gcc/brig/ChangeLog | 6 ++++++ gcc/brig/brig-lang.c | 4 ++-- gcc/c-family/ChangeLog | 8 ++++++++ gcc/c-family/c-common.c | 2 +- gcc/c-family/c-cppbuiltin.c | 2 +- gcc/c-family/c-opts.c | 11 +++++------ gcc/common.opt | 2 +- gcc/d/ChangeLog | 6 ++++++ gcc/d/d-lang.cc | 4 ++-- gcc/flags.h | 9 --------- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/options.c | 4 ++-- gcc/go/ChangeLog | 6 ++++++ gcc/go/go-lang.c | 4 ++-- gcc/langhooks.c | 2 +- gcc/lto/ChangeLog | 6 ++++++ gcc/lto/lto-lang.c | 3 ++- gcc/opts.c | 8 +++----- gcc/toplev.c | 16 ---------------- 22 files changed, 88 insertions(+), 51 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index df4d621f641..62aebf25ddc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2019-08-23 Jakub Jelinek + + PR middle-end/91283 + * common.opt (fexcess-precision=): Add Optimization flag. Use + flag_excess_precision variable instead of + flag_excess_precision_cmdline. + * flags.h (class target_flag_state): Remove x_flag_excess_precision + member. + (flag_excess_precision): Don't define. + * langhooks.c (lhd_post_options): Set flag_excess_precision instead of + flag_excess_precision_cmdline. Remove comment. + * opts.c (set_fast_math_flags): Use frontend_set_flag_excess_precision + and x_flag_excess_precision instead of + frontend_set_flag_excess_precision_cmdline and + x_flag_excess_precision_cmdline. + (fast_math_flags_set_p): Use x_flag_excess_precision instead of + x_flag_excess_precision_cmdline. + * toplev.c (init_excess_precision): Remove. + (lang_dependent_init_target): Don't call it. + 2019-08-23 Martin Liska * lto-wrapper.c (run_gcc): When setting jobserver diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 53ecd1a0ecb..b5c0b1ff2d7 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-08-23 Jakub Jelinek + + PR middle-end/91283 + * gcc-interface/misc.c (gnat_post_options): Set flag_excess_precision + instead of flag_excess_precision_cmdline. + 2019-08-21 Vadim Godunko * libgnat/g-expect.adb (Expect_Internal): Attempt to read diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c index c5822f6cb7b..a576b7e5a01 100644 --- a/gcc/ada/gcc-interface/misc.c +++ b/gcc/ada/gcc-interface/misc.c @@ -256,9 +256,9 @@ static bool gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED) { /* Excess precision other than "fast" requires front-end support. */ - if (flag_excess_precision_cmdline == EXCESS_PRECISION_STANDARD) + if (flag_excess_precision == EXCESS_PRECISION_STANDARD) sorry ("%<-fexcess-precision=standard%> for Ada"); - flag_excess_precision_cmdline = EXCESS_PRECISION_FAST; + flag_excess_precision = EXCESS_PRECISION_FAST; /* No psABI change warnings for Ada. */ warn_psabi = 0; diff --git a/gcc/brig/ChangeLog b/gcc/brig/ChangeLog index a5c3b9b500e..462cbab05af 100644 --- a/gcc/brig/ChangeLog +++ b/gcc/brig/ChangeLog @@ -1,3 +1,9 @@ +2019-08-23 Jakub Jelinek + + PR middle-end/91283 + * brig-lang.c (brig_langhook_post_options): Set flag_excess_precision + instead of flag_excess_precision_cmdline. + 2019-06-25 Jozef Lawrynowicz * brig-lang.c (brig_build_c_type_nodes): Accept "__intN__" diff --git a/gcc/brig/brig-lang.c b/gcc/brig/brig-lang.c index 1c3a3b00c41..96c6c572e94 100644 --- a/gcc/brig/brig-lang.c +++ b/gcc/brig/brig-lang.c @@ -166,8 +166,8 @@ brig_langhook_handle_option static bool brig_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED) { - if (flag_excess_precision_cmdline == EXCESS_PRECISION_DEFAULT) - flag_excess_precision_cmdline = EXCESS_PRECISION_STANDARD; + if (flag_excess_precision == EXCESS_PRECISION_DEFAULT) + flag_excess_precision = EXCESS_PRECISION_STANDARD; /* gccbrig casts pointers around like crazy, TBAA might produce broken code if not disabling it by default. Some PRM conformance tests such diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index a1a864a8e97..b8920f1c18d 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,11 @@ +2019-08-23 Jakub Jelinek + + PR middle-end/91283 + * c-common.c (c_ts18661_flt_eval_method): Use flag_excess_precision + instead of flag_excess_precision_cmdline. + * c-cppbuiltin.c (c_cpp_flt_eval_method_iec_559): Likewise. + * c-opts.c (c_common_post_options): Likewise. + 2019-08-22 Martin Sebor PR middle-end/91490 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 0aaa246d3cc..d516deaf24c 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -8345,7 +8345,7 @@ c_ts18661_flt_eval_method (void) = targetm.c.excess_precision (EXCESS_PRECISION_TYPE_IMPLICIT); enum excess_precision_type flag_type - = (flag_excess_precision_cmdline == EXCESS_PRECISION_STANDARD + = (flag_excess_precision == EXCESS_PRECISION_STANDARD ? EXCESS_PRECISION_TYPE_STANDARD : EXCESS_PRECISION_TYPE_FAST); diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index d389f8ca4a0..6006e95b068 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -746,7 +746,7 @@ static bool c_cpp_flt_eval_method_iec_559 (void) { enum excess_precision_type front_end_ept - = (flag_excess_precision_cmdline == EXCESS_PRECISION_STANDARD + = (flag_excess_precision == EXCESS_PRECISION_STANDARD ? EXCESS_PRECISION_TYPE_STANDARD : EXCESS_PRECISION_TYPE_FAST); diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 2d4af63cde4..da783e4990c 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -800,14 +800,13 @@ c_common_post_options (const char **pfilename) support. */ if (c_dialect_cxx ()) { - if (flag_excess_precision_cmdline == EXCESS_PRECISION_STANDARD) + if (flag_excess_precision == EXCESS_PRECISION_STANDARD) sorry ("%<-fexcess-precision=standard%> for C++"); - flag_excess_precision_cmdline = EXCESS_PRECISION_FAST; + flag_excess_precision = EXCESS_PRECISION_FAST; } - else if (flag_excess_precision_cmdline == EXCESS_PRECISION_DEFAULT) - flag_excess_precision_cmdline = (flag_iso - ? EXCESS_PRECISION_STANDARD - : EXCESS_PRECISION_FAST); + else if (flag_excess_precision == EXCESS_PRECISION_DEFAULT) + flag_excess_precision = (flag_iso ? EXCESS_PRECISION_STANDARD + : EXCESS_PRECISION_FAST); /* ISO C restricts floating-point expression contraction to within source-language expressions (-ffp-contract=on, currently an alias diff --git a/gcc/common.opt b/gcc/common.opt index c1605385712..f2214ed93ad 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1399,7 +1399,7 @@ Common Report Var(flag_expensive_optimizations) Optimization Perform a number of minor, expensive optimizations. fexcess-precision= -Common Joined RejectNegative Enum(excess_precision) Var(flag_excess_precision_cmdline) Init(EXCESS_PRECISION_DEFAULT) SetByCombined +Common Joined RejectNegative Enum(excess_precision) Var(flag_excess_precision) Init(EXCESS_PRECISION_DEFAULT) Optimization SetByCombined -fexcess-precision=[fast|standard] Specify handling of excess floating-point precision. Enum diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index a7821c28d46..1013c08d12b 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,9 @@ +2019-08-23 Jakub Jelinek + + PR middle-end/91283 + * d-lang.cc (d_post_options): Set flag_excess_precision instead of + flag_excess_precision_cmdline. + 2019-08-20 Iain Buclaw PR d/88722 diff --git a/gcc/d/d-lang.cc b/gcc/d/d-lang.cc index db0db0e71dc..5cdb8963233 100644 --- a/gcc/d/d-lang.cc +++ b/gcc/d/d-lang.cc @@ -772,8 +772,8 @@ d_post_options (const char ** fn) if (global_options_set.x_flag_max_errors) global.errorLimit = flag_max_errors; - if (flag_excess_precision_cmdline == EXCESS_PRECISION_DEFAULT) - flag_excess_precision_cmdline = EXCESS_PRECISION_STANDARD; + if (flag_excess_precision == EXCESS_PRECISION_DEFAULT) + flag_excess_precision = EXCESS_PRECISION_STANDARD; if (global.params.useUnitTests) global.params.useAssert = true; diff --git a/gcc/flags.h b/gcc/flags.h index 0b9cd12e6cc..5bf9b49c2b6 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -51,9 +51,6 @@ public: align_flags x_align_jumps; align_flags x_align_labels; align_flags x_align_functions; - - /* The excess precision currently in effect. */ - enum excess_precision x_flag_excess_precision; }; extern class target_flag_state default_target_flag_state; @@ -68,12 +65,6 @@ extern class target_flag_state *this_target_flag_state; #define align_labels (this_target_flag_state->x_align_labels) #define align_functions (this_target_flag_state->x_align_functions) -/* String representaions of the above options are available in - const char *str_align_foo. NULL if not set. */ - -#define flag_excess_precision \ - (this_target_flag_state->x_flag_excess_precision) - /* Returns TRUE if generated code should match ABI version N or greater is in use. */ diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ea81f105888..e454bd264d9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-08-23 Jakub Jelinek + + PR middle-end/91283 + * options.c (gfc_post_options): Set flag_excess_precision instead of + flag_excess_precision_cmdline. Remove comment. + 2019-08-23 Mark Eggleston * intrinsics.text: Removed empty sections. The order of diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index 146be2f1420..771c10e4985 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -264,9 +264,9 @@ gfc_post_options (const char **pfilename) /* Excess precision other than "fast" requires front-end support. */ - if (flag_excess_precision_cmdline == EXCESS_PRECISION_STANDARD) + if (flag_excess_precision == EXCESS_PRECISION_STANDARD) sorry ("%<-fexcess-precision=standard%> for Fortran"); - flag_excess_precision_cmdline = EXCESS_PRECISION_FAST; + flag_excess_precision = EXCESS_PRECISION_FAST; /* Fortran allows associative math - but we cannot reassociate if we want traps or signed zeros. Cf. also flag_protect_parens. */ diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 9413c20ed99..47400e25a45 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,9 @@ +2019-08-23 Jakub Jelinek + + PR middle-end/91283 + * go-lang.c (go_langhook_post_options): Set flag_excess_precision + instead of flag_excess_precision_cmdline. + 2019-07-02 Cherry Zhang * go-gcc.cc (Gcc_backend::Gcc_backend): Define __builtin_memset. diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c index 94f2cb25df3..a6bda936ed7 100644 --- a/gcc/go/go-lang.c +++ b/gcc/go/go-lang.c @@ -293,8 +293,8 @@ go_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED) go_add_search_path (dir); go_search_dirs.release (); - if (flag_excess_precision_cmdline == EXCESS_PRECISION_DEFAULT) - flag_excess_precision_cmdline = EXCESS_PRECISION_STANDARD; + if (flag_excess_precision == EXCESS_PRECISION_DEFAULT) + flag_excess_precision = EXCESS_PRECISION_STANDARD; /* Tail call optimizations can confuse uses of runtime.Callers. */ if (!global_options_set.x_flag_optimize_sibling_calls) diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 22ace130a62..89fb5bc3ad8 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -97,7 +97,7 @@ lhd_post_options (const char ** ARG_UNUSED (pfilename)) { /* Excess precision other than "fast" requires front-end support. */ - flag_excess_precision_cmdline = EXCESS_PRECISION_FAST; + flag_excess_precision = EXCESS_PRECISION_FAST; return false; } diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 2467d78f2a2..4e68fbf2854 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2019-08-23 Jakub Jelinek + + PR middle-end/91283 + * lto-lang.c (lto_post_options): Set flag_excess_precision instead of + flag_excess_precision_cmdline. Remove comment. + 2019-08-13 Richard Sandiford PR middle-end/91421 diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c index cc44afc048c..414eaf2075a 100644 --- a/gcc/lto/lto-lang.c +++ b/gcc/lto/lto-lang.c @@ -927,7 +927,8 @@ lto_post_options (const char **pfilename ATTRIBUTE_UNUSED) /* Excess precision other than "fast" requires front-end support. */ - flag_excess_precision_cmdline = EXCESS_PRECISION_FAST; + if (flag_excess_precision == EXCESS_PRECISION_DEFAULT) + flag_excess_precision = EXCESS_PRECISION_FAST; /* When partitioning, we can tear appart STRING_CSTs uses from the same TU into multiple partitions. Without constant merging the constants diff --git a/gcc/opts.c b/gcc/opts.c index bb0d8b5e7db..1417dba8e4c 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2971,9 +2971,8 @@ set_fast_math_flags (struct gcc_options *opts, int set) opts->x_flag_errno_math = !set; if (set) { - if (opts->frontend_set_flag_excess_precision_cmdline - == EXCESS_PRECISION_DEFAULT) - opts->x_flag_excess_precision_cmdline + if (opts->frontend_set_flag_excess_precision == EXCESS_PRECISION_DEFAULT) + opts->x_flag_excess_precision = set ? EXCESS_PRECISION_FAST : EXCESS_PRECISION_DEFAULT; if (!opts->frontend_set_flag_signaling_nans) opts->x_flag_signaling_nans = 0; @@ -3008,8 +3007,7 @@ fast_math_flags_set_p (const struct gcc_options *opts) && opts->x_flag_finite_math_only && !opts->x_flag_signed_zeros && !opts->x_flag_errno_math - && opts->x_flag_excess_precision_cmdline - == EXCESS_PRECISION_FAST); + && opts->x_flag_excess_precision == EXCESS_PRECISION_FAST); } /* Return true iff flags are set as if -ffast-math but using the flags stored diff --git a/gcc/toplev.c b/gcc/toplev.c index ddbb8b49436..d741a66f385 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1841,27 +1841,11 @@ backend_init (void) init_regs (); } -/* Initialize excess precision settings. - - We have no need to modify anything here, just keep track of what the - user requested. We'll figure out any appropriate relaxations - later. */ - -static void -init_excess_precision (void) -{ - gcc_assert (flag_excess_precision_cmdline != EXCESS_PRECISION_DEFAULT); - flag_excess_precision = flag_excess_precision_cmdline; -} - /* Initialize things that are both lang-dependent and target-dependent. This function can be called more than once if target parameters change. */ static void lang_dependent_init_target (void) { - /* This determines excess precision settings. */ - init_excess_precision (); - /* This creates various _DECL nodes, so needs to be called after the front end is initialized. It also depends on the HAVE_xxx macros generated from the target machine description. */ -- 2.30.2