PR122325 reports that -ffast-math no longer enables -fcx-limited-range.
This is due to the weird handling of flag_default_complex_method which
the following simply removes. Frontends that wish to impose a default
evaluation method that is not -fcx-fortran-rules (the current default
of flag_default_complex_method) need to imposed that in ther
init_options_struct langhook which those requesting C std rules already
do and I'm adding that for the fortran frontend, explicitly requesting
fortran rules.
PR middle-end/122325
gcc/
* common.opt (flag_default_complex_method): Remove.
* opts.cc (init_options_struct): Default to fortran rules
for complex evaluations.
(finish_options): Remove (re-)instantiating of the frontend
default of the complex evaluation method.
gcc/c-family/
* c-opts.cc (c_common_init_options_struct): Remove set of
flag_default_complex_method.
gcc/go/
* go-lang.cc (go_langhook_init_options_struct): Remove set of
flag_default_complex_method.
gcc/lto/
* lto-lang.cc (lto_init_options_struct): Remove set of
flag_default_complex_method.
gcc/fortran/
* options.cc (gfc_init_options_struct): Set flag_complex_method
to fortran rules.
gcc/testsuite/
* gcc.dg/complex-8.c: New testcase.
* gcc.dg/complex-9.c: Likewise.
/* By default, C99-like requirements for complex multiply and divide. */
opts->x_flag_complex_method = 2;
- opts->x_flag_default_complex_method = opts->x_flag_complex_method;
}
/* Common initialization before calling option handlers. */
Variable
enum incremental_link flag_incremental_link = INCREMENTAL_LINK_NONE
-Variable
-int flag_default_complex_method = 1
-
; Language specific warning pass for unused results.
Variable
bool flag_warn_unused_result = false
opts->frontend_set_flag_errno_math = true;
opts->x_flag_associative_math = -1;
opts->frontend_set_flag_associative_math = true;
+ opts->x_flag_complex_method = 1;
}
/* Get ready for options handling. Keep in sync with
/* Default to avoiding range issues for complex multiply and
divide. */
opts->x_flag_complex_method = 2;
- opts->x_flag_default_complex_method = opts->x_flag_complex_method;
/* The builtin math functions should not set errno. */
opts->x_flag_errno_math = 0;
safe choice. This will pessimize Fortran code with LTO unless
people specify a complex method manually or use -ffast-math. */
opts->x_flag_complex_method = 2;
- opts->x_flag_default_complex_method = opts->x_flag_complex_method;
}
/* Handle command-line option SCODE. If the option takes an argument, it is
/* Some targets have ABI-specified unwind tables. */
opts->x_flag_unwind_tables = targetm_common.unwind_tables_default;
+ /* Languages not explicitly specifying a default get fortran rules. */
+ opts->x_flag_complex_method = 1;
+
/* Some targets have other target-specific initialization. */
targetm_common.option_init_struct (opts);
}
|| opts->x_flag_peel_loops
|| opts->x_optimize >= 3);
- /* Use a frontend provided default for the complex eval method. */
- if (!opts_set->x_flag_complex_method)
- opts->x_flag_complex_method = opts->x_flag_default_complex_method;
-
/* Use -fvect-cost-model=cheap instead of -fvect-cost-mode=very-cheap
by default with explicit -ftree-{loop,slp}-vectorize. */
if (opts->x_optimize == 2
--- /dev/null
+/* PR tree-optimization/122325. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-cplxlower" } */
+/* { dg-require-effective-target double64 } */
+
+__complex double
+foo (__complex double a, __complex double b)
+{
+ return a / b;
+}
+
+/* { dg-final { scan-tree-dump-times "__(?:gnu_)?divdc3" 1 "cplxlower1" } } */
--- /dev/null
+/* PR tree-optimization/122325. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math -fdump-tree-cplxlower" } */
+/* { dg-require-effective-target double64 } */
+
+__complex double
+foo (__complex double a, __complex double b)
+{
+ return a / b;
+}
+
+/* { dg-final { scan-tree-dump-not "__(?:gnu_)?divdc3" "cplxlower1" } } */