public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/PR102585-var-tracking-options-fix-v2)] options: Fix variable tracking option processing. Date: Fri, 15 Oct 2021 14:27:16 +0000 (GMT) [thread overview] Message-ID: <20211015142716.F2E783857C7F@sourceware.org> (raw) https://gcc.gnu.org/g:827647ab23b8bec9d20094e009341598e12a644b commit 827647ab23b8bec9d20094e009341598e12a644b Author: Martin Liska <mliska@suse.cz> Date: Thu Oct 14 14:57:18 2021 +0200 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. * toplev.c (process_options): Remove it here. gcc/testsuite/ChangeLog: * gcc.dg/pr102585.c: New test. Diff: --- gcc/config/nvptx/nvptx.c | 1 + gcc/opts.c | 19 +++++++++++++++++++ gcc/testsuite/gcc.dg/pr102585.c | 6 ++++++ gcc/toplev.c | 21 +-------------------- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 951252e598a..1e4b26381c5 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -219,6 +219,7 @@ nvptx_option_override (void) flag_toplevel_reorder = 1; debug_nonbind_markers_p = 0; + OPTION_SET_P (debug_nonbind_markers_p) = 1; /* Set flag_no_common, unless explicitly disabled. We fake common using .weak, and that's not entirely accurate, so avoid it diff --git a/gcc/opts.c b/gcc/opts.c index 65fe192a198..bf3a81c287e 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1349,6 +1349,25 @@ 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"); } #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 4f574a5aad3..7c0467948f2 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1494,6 +1494,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 @@ -1502,26 +1503,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
next reply other threads:[~2021-10-15 14:27 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-15 14:27 Martin Liska [this message] -- strict thread matches above, loose matches on Subject: below -- 2021-10-15 11:06 Martin Liska 2021-10-14 12:58 Martin Liska
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=20211015142716.F2E783857C7F@sourceware.org \ --to=marxin@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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).