Fix big memory leak in ix86_valid_target_attribute_p
* config/i386/i386.c (ix86_valid_target_attribute_p): Finalize options at the of the function. * gcc.c (driver_get_configure_time_options): Call newly introduced init_opts_obstack. * lto-wrapper.c (main): Likewise. * opts.c (init_opts_obstack): New function. (init_options_struct): Call newly introduced init_opts_obstack. * opts.h (init_options_struct): Declare. From-SVN: r230264
This commit is contained in:
parent
808b6bb7a8
commit
de5672fcb2
|
@ -1,3 +1,15 @@
|
||||||
|
2015-11-12 Martin Liska <mliska@suse.cz>
|
||||||
|
|
||||||
|
* config/i386/i386.c (ix86_valid_target_attribute_p):
|
||||||
|
Finalize options at the of the function.
|
||||||
|
* gcc.c (driver_get_configure_time_options): Call newly
|
||||||
|
introduced init_opts_obstack.
|
||||||
|
* lto-wrapper.c (main): Likewise.
|
||||||
|
* opts.c (init_opts_obstack): New function.
|
||||||
|
(init_options_struct): Call newly
|
||||||
|
introduced init_opts_obstack.
|
||||||
|
* opts.h (init_options_struct): Declare.
|
||||||
|
|
||||||
2015-11-12 Martin Liska <mliska@suse.cz>
|
2015-11-12 Martin Liska <mliska@suse.cz>
|
||||||
|
|
||||||
PR ipa/68035
|
PR ipa/68035
|
||||||
|
|
|
@ -6237,6 +6237,8 @@ ix86_valid_target_attribute_p (tree fndecl,
|
||||||
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) = new_optimize;
|
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) = new_optimize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finalize_options_struct (&func_options);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9915,7 +9915,7 @@ driver_get_configure_time_options (void (*cb) (const char *option,
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
obstack_init (&obstack);
|
obstack_init (&obstack);
|
||||||
gcc_obstack_init (&opts_obstack);
|
init_opts_obstack ();
|
||||||
n_switches = 0;
|
n_switches = 0;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE (option_default_specs); i++)
|
for (i = 0; i < ARRAY_SIZE (option_default_specs); i++)
|
||||||
|
|
|
@ -1355,7 +1355,7 @@ main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
gcc_obstack_init (&opts_obstack);
|
init_opts_obstack ();
|
||||||
|
|
||||||
p = argv[0] + strlen (argv[0]);
|
p = argv[0] + strlen (argv[0]);
|
||||||
while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
|
while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1]))
|
||||||
|
|
16
gcc/opts.c
16
gcc/opts.c
|
@ -266,6 +266,20 @@ add_comma_separated_to_vector (void **pvec, const char *arg)
|
||||||
*pvec = v;
|
*pvec = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Initialize opts_obstack if not initialized. */
|
||||||
|
|
||||||
|
void
|
||||||
|
init_opts_obstack (void)
|
||||||
|
{
|
||||||
|
static bool opts_obstack_initialized = false;
|
||||||
|
|
||||||
|
if (!opts_obstack_initialized)
|
||||||
|
{
|
||||||
|
opts_obstack_initialized = true;
|
||||||
|
gcc_obstack_init (&opts_obstack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize OPTS and OPTS_SET before using them in parsing options. */
|
/* Initialize OPTS and OPTS_SET before using them in parsing options. */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -273,7 +287,7 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
|
||||||
{
|
{
|
||||||
size_t num_params = get_num_compiler_params ();
|
size_t num_params = get_num_compiler_params ();
|
||||||
|
|
||||||
gcc_obstack_init (&opts_obstack);
|
init_opts_obstack ();
|
||||||
|
|
||||||
*opts = global_options_init;
|
*opts = global_options_init;
|
||||||
|
|
||||||
|
|
|
@ -323,6 +323,7 @@ extern void decode_cmdline_options_to_array (unsigned int argc,
|
||||||
extern void init_options_once (void);
|
extern void init_options_once (void);
|
||||||
extern void init_options_struct (struct gcc_options *opts,
|
extern void init_options_struct (struct gcc_options *opts,
|
||||||
struct gcc_options *opts_set);
|
struct gcc_options *opts_set);
|
||||||
|
extern void init_opts_obstack (void);
|
||||||
extern void finalize_options_struct (struct gcc_options *opts);
|
extern void finalize_options_struct (struct gcc_options *opts);
|
||||||
extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
|
extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
|
||||||
const char **argv,
|
const char **argv,
|
||||||
|
|
Loading…
Reference in New Issue