From b4702276615ff8d43bc910e7a54fdd850ad8d461 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 14 Oct 2021 14:57:18 +0200 Subject: 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/opts.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'gcc/opts.c') diff --git a/gcc/opts.c b/gcc/opts.c index 65fe192..4472cec 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 -- cgit v1.1