[PATCH] Fix init_reload memory leak

Jeff Law law@redhat.com
Mon Jan 21 14:46:00 GMT 2013


On 01/21/2013 07:36 AM, Jakub Jelinek wrote:
> Hi!
>
> While working on the multiversioning patch I've just posted,
> I've noticed that on say:
> void foo ();
> void foo () __attribute__((target ("avx")));
> void foo () __attribute__((target ("default")));
> __attribute__((target ("default"))) void foo ()
> {
> }
> __attribute__((target ("avx"))) void foo ()
> {
> }
> void (*fn) () = foo;
> we leak memory, because init_reload is called several times (due to target
> attribute) and it never destroys reload_obstack already created before
> initializing a new one.  Fixed by initializing it just once.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2013-01-21  Jakub Jelinek  <jakub@redhat.com>
>
> 	* reload1.c (init_reload): Only initialize reload_obstack
> 	during the first call.
OK.
jeff



More information about the Gcc-patches mailing list