This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Prevent freed memory access when dumping SSA stats



The code to dump SSA stats was trying to dump hash table statistics for DEF_BLOCKS after it had been deleted.


Tested on x86.


Diego.
2005-02-22  Diego Novillo  <dnovillo@redhat.com>

	* tree-into-ssa.c (rewrite_blocks): Move debug dumps from ...
	(rewrite_into_ssa): ... here.

Index: tree-into-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-into-ssa.c,v
retrieving revision 2.39
diff -d -u -p -r2.39 tree-into-ssa.c
--- tree-into-ssa.c	17 Feb 2005 16:19:41 -0000	2.39
+++ tree-into-ssa.c	22 Feb 2005 14:57:54 -0000
@@ -1477,7 +1477,15 @@ rewrite_blocks (bool fix_virtual_phis)
   /* Finalize the dominator walker.  */
   fini_walk_dominator_tree (&walk_data);
 
+  /* Debugging dumps.  */
+  if (dump_file && (dump_flags & TDF_STATS))
+    {
+      dump_dfa_stats (dump_file);
+      dump_tree_ssa_stats (dump_file);
+    }
+
   htab_delete (def_blocks);
+  def_blocks = NULL;
   
   VEC_free (tree_on_heap, block_defs_stack);
   block_defs_stack = NULL;
@@ -1611,13 +1619,6 @@ rewrite_into_ssa (bool all)
 
   rewrite_blocks (false);
 
-  /* Debugging dumps.  */
-  if (dump_file && (dump_flags & TDF_STATS))
-    {
-      dump_dfa_stats (dump_file);
-      dump_tree_ssa_stats (dump_file);
-    }
-
   /* Free allocated memory.  */
   FOR_EACH_BB (bb)
     BITMAP_FREE (dfs[bb->index]);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]