public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-83] middle-end/105461 - opts processing of -fvar-tracking
@ 2022-05-03 10:33 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-05-03 10:33 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6b4cc784806ac8676a08ecbbeadbd1bfa56073bb

commit r13-83-g6b4cc784806ac8676a08ecbbeadbd1bfa56073bb
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 3 10:36:30 2022 +0200

    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.

Diff:
---
 gcc/opts.cc                     |  3 +--
 gcc/testsuite/gcc.dg/pr105461.c | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/gcc/opts.cc b/gcc/opts.cc
index 1378ef781d0..2ffbf429b7b 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 00000000000..1e6743ccac2
--- /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);
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-03 10:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 10:33 [gcc r13-83] middle-end/105461 - opts processing of -fvar-tracking Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).