aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-05-03 10:36:30 +0200
committerRichard Biener <rguenther@suse.de>2022-05-03 11:19:20 +0200
commit6b4cc784806ac8676a08ecbbeadbd1bfa56073bb (patch)
tree777dbc28b217da71aaab56e1a65aeaa0e0af6a62 /gcc
parent99f55024b0609e0d85f6c58828faad3c51a49749 (diff)
downloadgcc-6b4cc784806ac8676a08ecbbeadbd1bfa56073bb.zip
gcc-6b4cc784806ac8676a08ecbbeadbd1bfa56073bb.tar.gz
gcc-6b4cc784806ac8676a08ecbbeadbd1bfa56073bb.tar.bz2
middle-end/105461 - opts processing of -fvar-tracking
The flag_var_tracking reset in finish_options doesn't match the condition in process_options, in particular we fail to reset it when the option was specified on the command line. The following fixes this and also alters the debug info level guard to match the one in process_options. 2022-05-03 Richard Biener <rguenther@suse.de> PR middle-end/105461 * opts.cc (finish_options): Match the condition to disable flag_var_tracking to that of process_options. * gcc.dg/pr105461.c: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/opts.cc3
-rw-r--r--gcc/testsuite/gcc.dg/pr105461.c16
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/opts.cc b/gcc/opts.cc
index 1378ef7..2ffbf42 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -1329,8 +1329,7 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
/* Note -fvar-tracking is enabled automatically with OPT_LEVELS_1_PLUS and
so we need to drop it if we are called from optimize attribute. */
- if (debug_info_level == DINFO_LEVEL_NONE
- && !opts_set->x_flag_var_tracking)
+ if (debug_info_level < DINFO_LEVEL_NORMAL)
flag_var_tracking = false;
/* One could use EnabledBy, but it would lead to a circular dependency. */
diff --git a/gcc/testsuite/gcc.dg/pr105461.c b/gcc/testsuite/gcc.dg/pr105461.c
new file mode 100644
index 0000000..1e6743c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr105461.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fassociative-math -fsignaling-nans -fvar-tracking -w" } */
+
+int
+bar (float *x, int y)
+{
+ *x = y;
+
+ return *x;
+}
+
+__attribute__ ((optimize ("O2"))) void
+foo (float *x, int y)
+{
+ int a = bar (x, y);
+}