public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix ipa-pure-const memory leak (PR middle-end/56461)
@ 2013-02-27 16:04 Jakub Jelinek
  2013-02-27 19:52 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2013-02-27 16:04 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

Hi!

The release_node hook is only called when a cgraph node is removed, not
when it merely gets ->analyzed field cleared.  If that happens on
some node that has_function_state, we leak the memory.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?

2013-02-27  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/56461
	* ipa-pure-const.c (propagate): Use FOR_EACH_FUNCTION instead of
	FOR_EACH_DEFINED_FUNCTION when freeing state.

--- gcc/ipa-pure-const.c.jj	2013-02-08 13:16:55.000000000 +0100
+++ gcc/ipa-pure-const.c	2013-02-27 11:20:54.876786950 +0100
@@ -1479,7 +1479,7 @@ propagate (void)
   propagate_pure_const ();
 
   /* Cleanup. */
-  FOR_EACH_DEFINED_FUNCTION (node)
+  FOR_EACH_FUNCTION (node)
     if (has_function_state (node))
       free (get_function_state (node));
   funct_state_vec.release ();

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix ipa-pure-const memory leak (PR middle-end/56461)
  2013-02-27 16:04 [PATCH] Fix ipa-pure-const memory leak (PR middle-end/56461) Jakub Jelinek
@ 2013-02-27 19:52 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2013-02-27 19:52 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On 2/27/13 5:03 PM, Jakub Jelinek wrote:
> Hi!
> 
> The release_node hook is only called when a cgraph node is removed, not
> when it merely gets ->analyzed field cleared.  If that happens on
> some node that has_function_state, we leak the memory.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk?

Ok.

Thanks,
Richard.

> 2013-02-27  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/56461
> 	* ipa-pure-const.c (propagate): Use FOR_EACH_FUNCTION instead of
> 	FOR_EACH_DEFINED_FUNCTION when freeing state.
> 
> --- gcc/ipa-pure-const.c.jj	2013-02-08 13:16:55.000000000 +0100
> +++ gcc/ipa-pure-const.c	2013-02-27 11:20:54.876786950 +0100
> @@ -1479,7 +1479,7 @@ propagate (void)
>    propagate_pure_const ();
>  
>    /* Cleanup. */
> -  FOR_EACH_DEFINED_FUNCTION (node)
> +  FOR_EACH_FUNCTION (node)
>      if (has_function_state (node))
>        free (get_function_state (node));
>    funct_state_vec.release ();
> 
> 	Jakub
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-27 19:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-27 16:04 [PATCH] Fix ipa-pure-const memory leak (PR middle-end/56461) Jakub Jelinek
2013-02-27 19:52 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).