This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix ipa-pure-const memory leak (PR middle-end/56461)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 27 Feb 2013 17:03:53 +0100
- Subject: [PATCH] Fix ipa-pure-const memory leak (PR middle-end/56461)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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