[tree-ssa] memory leak

Jan Hubicka jh@suse.cz
Sun Mar 14 16:59:00 GMT 2004


Hi,
tree-ssa rewriter allocates arrays by n_basic_blocks size and then
access it using bb indexes creating interesting memory corruptions on
profiling branch.  I don't have testcase reproducing on tree-ssa
(perhaps blocks happens to be always compacted), but still I would like
to apply it.  OK?

Bootstrapped/regtested ppc-linux

2004-03-14  Jan Hubicka  <jh@suse.cz>
	* tree-ssa.c (rewrite_into_ssa, compute_global_livein): Fix.
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa.c,v
retrieving revision 1.1.4.199.2.2
diff -c -3 -p -r1.1.4.199.2.2 tree-ssa.c
*** tree-ssa.c	3 Mar 2004 14:18:20 -0000	1.1.4.199.2.2
--- tree-ssa.c	14 Mar 2004 16:55:02 -0000
*************** rewrite_into_ssa (void)
*** 375,381 ****
  
       Also count the number of predecessors for each block.  Doing so
       can save significant time during PHI insertion for large graphs.  */
!   dfs = (bitmap *) xmalloc (n_basic_blocks * sizeof (bitmap *));
    FOR_EACH_BB (bb)
      {
        edge e;
--- 375,381 ----
  
       Also count the number of predecessors for each block.  Doing so
       can save significant time during PHI insertion for large graphs.  */
!   dfs = (bitmap *) xmalloc (last_basic_block * sizeof (bitmap *));
    FOR_EACH_BB (bb)
      {
        edge e;
*************** compute_global_livein (bitmap livein, bi
*** 507,513 ****
    basic_block bb, *worklist, *tos;
  
    tos = worklist
!     = (basic_block *) xmalloc (sizeof (basic_block) * (n_basic_blocks + 1));
  
    /* Initialize the worklist.  */
    FOR_EACH_BB (bb)
--- 507,513 ----
    basic_block bb, *worklist, *tos;
  
    tos = worklist
!     = (basic_block *) xmalloc (sizeof (basic_block) * (last_basic_block + 1));
  
    /* Initialize the worklist.  */
    FOR_EACH_BB (bb)



More information about the Gcc-patches mailing list