https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91399
Bug ID: 91399
Summary: parse_mtune_ctrl_str shouldn't use
ix86_tune_ctrl_string
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
CC: ubizjak at gmail dot com
Target Milestone: ---
Target: i386
There are
static void
parse_mtune_ctrl_str (bool dump)
{
if (!ix86_tune_ctrl_string)
return;
parse_mtune_ctrl_str is only called from set_ix86_tune_features, which
is only called from ix86_function_specific_restore and
ix86_option_override_internal. parse_mtune_ctrl_str shouldn't use
ix86_tune_ctrl_string which is defined with global_options. Instead,
opts should be passed to parse_mtune_ctrl_str:
diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c
index 8e7c9c8363a2..b9d526ecc9d5 100644
--- a/gcc/config/i386/i386-options.c
+++ b/gcc/config/i386/i386-options.c
@@ -655,7 +655,8 @@ ix86_option_override_internal (bool main_args_p,
struct gcc_options *opts,
struct gcc_options *opts_set);
static void
-set_ix86_tune_features (enum processor_type ix86_tune, bool dump);
+set_ix86_tune_features (struct gcc_options *opts,
+ enum processor_type ix86_tune, bool dump);
/* Restore the current options */
@@ -730,7 +731,7 @@ ix86_function_specific_restore (struct gcc_options *opts,
/* Recreate the tune optimization tests */
if (old_tune != ix86_tune)
- set_ix86_tune_features (ix86_tune, false);
+ set_ix86_tune_features (opts, ix86_tune, false);
}
/* Adjust target options after streaming them in. This is mainly about
@@ -1458,13 +1464,13 @@ ix86_parse_stringop_strategy_string (char
*strategy_str, bool is_memset)
print the features that are explicitly set. */
static void
-parse_mtune_ctrl_str (bool dump)
+parse_mtune_ctrl_str (struct gcc_options *opts, bool dump)
{
- if (!ix86_tune_ctrl_string)
+ if (!opts->x_ix86_tune_ctrl_string)
return;
char *next_feature_string = NULL;
- char *curr_feature_string = xstrdup (ix86_tune_ctrl_string);
+ char *curr_feature_string = xstrdup (opts->x_ix86_tune_ctrl_string);
char *orig = curr_feature_string;
int i;
do
@@ -1503,7 +1509,8 @@ parse_mtune_ctrl_str (bool dump)
processor type. */
static void
-set_ix86_tune_features (enum processor_type ix86_tune, bool dump)
+set_ix86_tune_features (struct gcc_options *opts,
+ enum processor_type ix86_tune, bool dump)
{
unsigned HOST_WIDE_INT ix86_tune_mask = HOST_WIDE_INT_1U << ix86_tune;
int i;
@@ -1525,7 +1532,7 @@ set_ix86_tune_features (enum processor_type ix86_tune,
bool dump)
ix86_tune_features[i] ? "on" : "off");
}
- parse_mtune_ctrl_str (dump);
+ parse_mtune_ctrl_str (opts, dump);
}
@@ -2230,7 +2237,7 @@ ix86_option_override_internal (bool main_args_p,
XDELETEVEC (s);
}
- set_ix86_tune_features (ix86_tune, opts->x_ix86_dump_tunes);
+ set_ix86_tune_features (opts, ix86_tune, opts->x_ix86_dump_tunes);
#ifndef USE_IX86_FRAME_POINTER
#define USE_IX86_FRAME_POINTER 0