[PATCH] Fix ipa-cp memory leaks (PR middle-end/56461)

Jakub Jelinek jakub@redhat.com
Wed Feb 27 16:24:00 GMT 2013


Hi!

known_aggs is freed/released in another function, but not in
decide_whether_version_node, where it leaks 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-cp.c (decide_whether_version_node): Call vec_free on
	known_aggs[i].items and release known_aggs vector.

--- gcc/ipa-cp.c.jj	2013-02-21 22:24:12.000000000 +0100
+++ gcc/ipa-cp.c	2013-02-27 09:25:48.557980184 +0100
@@ -3406,6 +3406,9 @@ decide_whether_version_node (struct cgra
       info = IPA_NODE_REF (node);
       info->do_clone_for_all_contexts = false;
       IPA_NODE_REF (clone)->is_all_contexts_clone = true;
+      for (i = 0; i < count ; i++)
+	vec_free (known_aggs[i].items);
+      known_aggs.release ();
       ret = true;
     }
   else

	Jakub



More information about the Gcc-patches mailing list