Hi.

In following patch, I've added missing delete call for all item summaries that 
are
allocated within a function_summary container in case the container does not use
GGC memory allocation.

Can boostrap on ppc64le and no regression is seen on x86_64-linux-pc.

Ready for trunk?
Thanks,
Martin
>From c9912b88e8a381e6be7dc1e4be4f7b8859d72e2f Mon Sep 17 00:00:00 2001
From: mliska <mli...@suse.cz>
Date: Tue, 24 Mar 2015 13:58:50 +0100
Subject: [PATCH] Fix PR65538.

gcc/ChangeLog:

2015-03-24  Martin Liska  <mli...@suse.cz>

	PR tree-optimization/65538
	* symbol-summary.h (function_summary::~function_summary):
	Relese memory for allocated summaries in case non-GGC template
	instance.
---
 gcc/symbol-summary.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/symbol-summary.h b/gcc/symbol-summary.h
index 8d7e42c..35615ba 100644
--- a/gcc/symbol-summary.h
+++ b/gcc/symbol-summary.h
@@ -81,6 +81,12 @@ public:
     m_symtab_insertion_hook = NULL;
     m_symtab_removal_hook = NULL;
     m_symtab_duplication_hook = NULL;
+
+    /* Release all summaries in case we use non-GGC memory.  */
+    typedef typename hash_map <int, T *, summary_hashmap_traits>::iterator map_iterator;
+    if (!m_ggc)
+      for (map_iterator it = m_map.begin (); it != m_map.end (); ++it)
+	delete (*it).second;
   }
 
   /* Traverses all summarys with a function F called with
-- 
2.1.4

Reply via email to