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 <ja...@redhat.com> * reload1.c (init_reload): Only initialize reload_obstack during the first call. --- gcc/reload1.c.jj 2013-01-11 09:03:17.000000000 +0100 +++ gcc/reload1.c 2013-01-21 12:47:01.091040655 +0100 @@ -468,8 +468,11 @@ init_reload (void) } /* Initialize obstack for our rtl allocation. */ - gcc_obstack_init (&reload_obstack); - reload_startobj = XOBNEWVAR (&reload_obstack, char, 0); + if (reload_startobj == NULL) + { + gcc_obstack_init (&reload_obstack); + reload_startobj = XOBNEWVAR (&reload_obstack, char, 0); + } INIT_REG_SET (&spilled_pseudos); INIT_REG_SET (&changed_allocation_pseudos); Jakub