PR jit/63854: Fix memory leak within gcc_options

gcc/ChangeLog:
	PR jit/63854
	* opts.c (finalize_options_struct): New.
	* opts.h (finalize_options_struct): New.
	* toplev.c (toplev::finalize): Call finalize_options_struct
	on global_options and global_options_set.

From-SVN: r217791
This commit is contained in:
David Malcolm 2014-11-19 19:08:29 +00:00 committed by David Malcolm
parent 3bdf0a9ba5
commit 0ef443cf01
4 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2014-11-19 David Malcolm <dmalcolm@redhat.com>
PR jit/63854
* opts.c (finalize_options_struct): New.
* opts.h (finalize_options_struct): New.
* toplev.c (toplev::finalize): Call finalize_options_struct
on global_options and global_options_set.
2014-11-19 Manuel López-Ibáñez <manu@gcc.gnu.org>
Jakub Jelinek <jakub@redhat.com>

View File

@ -307,6 +307,14 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
targetm_common.option_init_struct (opts);
}
/* Release any allocations owned by OPTS. */
void
finalize_options_struct (struct gcc_options *opts)
{
XDELETEVEC (opts->x_param_values);
}
/* If indicated by the optimization level LEVEL (-Os if SIZE is set,
-Ofast if FAST is set, -Og if DEBUG is set), apply the option DEFAULT_OPT
to OPTS and OPTS_SET, diagnostic context DC, location LOC, with language

View File

@ -325,6 +325,7 @@ extern void decode_cmdline_options_to_array (unsigned int argc,
extern void init_options_once (void);
extern void init_options_struct (struct gcc_options *opts,
struct gcc_options *opts_set);
extern void finalize_options_struct (struct gcc_options *opts);
extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
const char **argv,
struct cl_decoded_option **decoded_options,

View File

@ -2170,4 +2170,7 @@ toplev::finalize (void)
ipa_cp_c_finalize ();
ipa_reference_c_finalize ();
params_c_finalize ();
finalize_options_struct (&global_options);
finalize_options_struct (&global_options_set);
}