This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p
- From: Martin LiÅka <mliska at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 12 Nov 2015 16:38:00 +0100
- Subject: Re: [PATCH 04/N] Fix big memory leak in ix86_valid_target_attribute_p
- Authentication-results: sourceware.org; auth=none
- References: <564081EF dot 7030003 at suse dot cz> <564463F4 dot 7080003 at suse dot cz> <CAFiYyc0vtRAwE2PX581th3aHbfuFSqycsw-Ra_60=3mFVii=hg at mail dot gmail dot com> <564478EE dot 4070809 at redhat dot com>
On 11/12/2015 12:33 PM, Bernd Schmidt wrote:
> On 11/12/2015 12:29 PM, Richard Biener wrote:
>> +static bool opts_obstack_initialized = false;
>> +
>> +/* Initialize opts_obstack if not initialized. */
>> +
>> +void
>> +init_opts_obstack (void)
>> +{
>> + if (!opts_obstack_initialized)
>> + {
>> + opts_obstack_initialized = true;
>> + gcc_obstack_init (&opts_obstack);
>>
>> you can move the static global to function scope.
>
> Also, why bother with it? Why not simply arrange to call the function just once at startup?
Hello.
It's called from multiple locations:
$ git grep init_opts_obstack
gcc/gcc.c: init_opts_obstack ();
gcc/lto-wrapper.c: init_opts_obstack ();
gcc/opts.c:init_opts_obstack (void)
gcc/opts.c: init_opts_obstack ();
gcc/opts.h:extern void init_opts_obstack (void);
Maybe there's a common ancestor of all paths, maybe it can be done as a follow-up.
>
> It's not clear from the submission why this is done and how it relates to the i386.c hunk.
Sorry that the hunk isn't explained better, in fast this change is unrelated and fixed
another memory leak.
Thanks,
Martin
>
>
> Bernd