From: "Martin Liška" <mliska@suse.cz>
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] options: Fix variable tracking option processing.
Date: Thu, 21 Oct 2021 15:14:02 +0200 [thread overview]
Message-ID: <525f12af-e92c-d6c4-462d-cb63b9f402b7@suse.cz> (raw)
In-Reply-To: <CAFiYyc2+qjNHPmi+YB5BFqXP0j+1EoWQEpe5n=PU3v6JeKWe8A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 562 bytes --]
On 10/21/21 11:57, Richard Biener wrote:
> which previously affected debug_nonbind_markers_p. I think it makes
> sense to move
> the above to finish_options as well. I suppose -help doesn't correctly dump
> the -g enabled state for -gtoggle at the moment?
All right, works for me. The updated patch was tested on nvptx cross compiler
and can bootstrap on x86_64-linux-gnu and survives regression tests.
The -g option is showed in -Q --help=common as:
-g
So no option value is displayed.
Is the patch fine now?
Thanks,
Martin
[-- Attachment #2: 0001-options-Fix-variable-tracking-option-processing.patch --]
[-- Type: text/x-patch, Size: 5877 bytes --]
From da24e51c8e108373256f1106fe4478b919189c99 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Thu, 14 Oct 2021 14:57:18 +0200
Subject: [PATCH] options: Fix variable tracking option processing.
PR debug/102585
PR bootstrap/102766
gcc/ChangeLog:
* opts.c (finish_options): Process flag_var_tracking* options
here as they can be adjusted by optimize attribute.
Process also flag_syntax_only and flag_gtoggle.
* toplev.c (process_options): Remove it here.
* common.opt: Make debug_nonbind_markers_p as PerFunction
attribute as it depends on optimization level.
gcc/testsuite/ChangeLog:
* gcc.dg/pr102585.c: New test.
---
gcc/common.opt | 2 +-
gcc/opts.c | 45 +++++++++++++++++++++++++++++++
gcc/testsuite/gcc.dg/pr102585.c | 6 +++++
gcc/toplev.c | 47 +--------------------------------
4 files changed, 53 insertions(+), 47 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/pr102585.c
diff --git a/gcc/common.opt b/gcc/common.opt
index a2af7fb36e0..c4a77f65aa2 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3284,7 +3284,7 @@ Common Driver JoinedOrMissing Negative(gvms)
Generate debug information in extended STABS format.
gstatement-frontiers
-Common Driver Var(debug_nonbind_markers_p)
+Common Driver Var(debug_nonbind_markers_p) PerFunction
Emit progressive recommended breakpoint locations.
gstrict-dwarf
diff --git a/gcc/opts.c b/gcc/opts.c
index 65fe192a198..4472cec1b98 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1349,6 +1349,51 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
SET_OPTION_IF_UNSET (opts, opts_set, flag_vect_cost_model,
VECT_COST_MODEL_CHEAP);
+ /* One could use EnabledBy, but it would lead to a circular dependency. */
+ if (!OPTION_SET_P (flag_var_tracking_uninit))
+ flag_var_tracking_uninit = flag_var_tracking;
+
+ if (!OPTION_SET_P (flag_var_tracking_assignments))
+ flag_var_tracking_assignments
+ = (flag_var_tracking
+ && !(flag_selective_scheduling || flag_selective_scheduling2));
+
+ if (flag_var_tracking_assignments_toggle)
+ flag_var_tracking_assignments = !flag_var_tracking_assignments;
+
+ if (flag_var_tracking_assignments && !flag_var_tracking)
+ flag_var_tracking = flag_var_tracking_assignments = -1;
+
+ if (flag_var_tracking_assignments
+ && (flag_selective_scheduling || flag_selective_scheduling2))
+ warning_at (loc, 0,
+ "var-tracking-assignments changes selective scheduling");
+
+ if (flag_syntax_only)
+ {
+ write_symbols = NO_DEBUG;
+ profile_flag = 0;
+ }
+
+ if (flag_gtoggle)
+ {
+ if (debug_info_level == DINFO_LEVEL_NONE)
+ {
+ debug_info_level = DINFO_LEVEL_NORMAL;
+
+ if (write_symbols == NO_DEBUG)
+ write_symbols = PREFERRED_DEBUGGING_TYPE;
+ }
+ else
+ debug_info_level = DINFO_LEVEL_NONE;
+ }
+
+ if (!OPTION_SET_P (debug_nonbind_markers_p))
+ debug_nonbind_markers_p
+ = (optimize
+ && debug_info_level >= DINFO_LEVEL_NORMAL
+ && dwarf_debuginfo_p ()
+ && !(flag_selective_scheduling || flag_selective_scheduling2));
}
#define LEFT_COLUMN 27
diff --git a/gcc/testsuite/gcc.dg/pr102585.c b/gcc/testsuite/gcc.dg/pr102585.c
new file mode 100644
index 00000000000..efd066b4a4e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr102585.c
@@ -0,0 +1,6 @@
+/* PR debug/102585 */
+/* { dg-do compile } */
+/* { dg-options "-fvar-tracking-assignments -fno-var-tracking" } */
+
+#pragma GCC optimize 0
+void d_demangle_callback_Og() { int c = 0; }
diff --git a/gcc/toplev.c b/gcc/toplev.c
index cb4f8c470f0..486bd8804fa 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1378,25 +1378,6 @@ process_options (bool no_backend)
}
}
- if (flag_syntax_only)
- {
- write_symbols = NO_DEBUG;
- profile_flag = 0;
- }
-
- if (flag_gtoggle)
- {
- if (debug_info_level == DINFO_LEVEL_NONE)
- {
- debug_info_level = DINFO_LEVEL_NORMAL;
-
- if (write_symbols == NO_DEBUG)
- write_symbols = PREFERRED_DEBUGGING_TYPE;
- }
- else
- debug_info_level = DINFO_LEVEL_NONE;
- }
-
/* CTF is supported for only C at this time. */
if (!lang_GNU_C ()
&& ctf_debug_info_level > CTFINFO_LEVEL_NONE)
@@ -1499,6 +1480,7 @@ process_options (bool no_backend)
}
flag_var_tracking = 0;
flag_var_tracking_uninit = 0;
+ flag_var_tracking_assignments = 0;
}
/* The debug hooks are used to implement -fdump-go-spec because it
@@ -1507,33 +1489,6 @@ process_options (bool no_backend)
if (flag_dump_go_spec != NULL)
debug_hooks = dump_go_spec_init (flag_dump_go_spec, debug_hooks);
- /* One could use EnabledBy, but it would lead to a circular dependency. */
- if (!OPTION_SET_P (flag_var_tracking_uninit))
- flag_var_tracking_uninit = flag_var_tracking;
-
- if (!OPTION_SET_P (flag_var_tracking_assignments))
- flag_var_tracking_assignments
- = (flag_var_tracking
- && !(flag_selective_scheduling || flag_selective_scheduling2));
-
- if (flag_var_tracking_assignments_toggle)
- flag_var_tracking_assignments = !flag_var_tracking_assignments;
-
- if (flag_var_tracking_assignments && !flag_var_tracking)
- flag_var_tracking = flag_var_tracking_assignments = -1;
-
- if (flag_var_tracking_assignments
- && (flag_selective_scheduling || flag_selective_scheduling2))
- warning_at (UNKNOWN_LOCATION, 0,
- "var-tracking-assignments changes selective scheduling");
-
- if (!OPTION_SET_P (debug_nonbind_markers_p))
- debug_nonbind_markers_p
- = (optimize
- && debug_info_level >= DINFO_LEVEL_NORMAL
- && dwarf_debuginfo_p ()
- && !(flag_selective_scheduling || flag_selective_scheduling2));
-
if (!OPTION_SET_P (dwarf2out_as_loc_support))
dwarf2out_as_loc_support = dwarf2out_default_as_loc_support ();
if (!OPTION_SET_P (dwarf2out_as_locview_support))
--
2.33.1
next prev parent reply other threads:[~2021-10-21 13:14 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-11 11:01 Martin Liška
2021-10-11 13:05 ` Richard Biener
2021-10-11 13:21 ` Martin Liška
2021-10-11 13:45 ` Richard Biener
2021-10-12 15:21 ` Martin Liška
2021-10-13 8:47 ` Richard Biener
2021-10-13 11:59 ` Martin Liška
2021-10-13 12:50 ` Richard Biener
2021-10-13 13:12 ` Martin Liška
2021-10-13 13:29 ` Richard Biener
2021-10-14 11:10 ` Martin Liška
2021-10-14 12:07 ` Richard Biener
2021-10-15 15:22 ` Martin Liška
2021-10-19 9:12 ` Richard Biener
2021-10-19 9:34 ` Martin Liška
2021-10-19 10:53 ` Richard Biener
2021-10-20 8:51 ` Martin Liška
2021-10-21 9:57 ` Richard Biener
2021-10-21 13:14 ` Martin Liška [this message]
2021-10-21 13:17 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=525f12af-e92c-d6c4-462d-cb63b9f402b7@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).