diff options
author | Richard Biener <rguenther@suse.de> | 2013-03-05 12:51:28 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-03-05 12:51:28 +0000 |
commit | 5e7f1aefc8b754e66193c18731555bdb0862c4ae (patch) | |
tree | dbb423ab934369b2eb339e3f89d2115b931ff519 /gcc | |
parent | f276b762ec8ead4f3133a676d68d67bfd22d3c1a (diff) | |
download | gcc-5e7f1aefc8b754e66193c18731555bdb0862c4ae.zip gcc-5e7f1aefc8b754e66193c18731555bdb0862c4ae.tar.gz gcc-5e7f1aefc8b754e66193c18731555bdb0862c4ae.tar.bz2 |
re PR middle-end/56525 (Access to ggc_freed memory in flow_loops_find)
2013-03-05 Richard Biener <rguenther@suse.de>
PR middle-end/56525
* loop-init.c (fix_loop_structure): Remove loops in two stages,
not freeing them until the end.
From-SVN: r196462
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/loop-init.c | 15 |
2 files changed, 18 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9d07f82..06a0ca2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-03-05 Richard Biener <rguenther@suse.de> + + PR middle-end/56525 + * loop-init.c (fix_loop_structure): Remove loops in two stages, + not freeing them until the end. + 2013-03-05 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> * config/s390/s390.h: Define DWARF2_ASM_LINE_DEBUG_INFO. diff --git a/gcc/loop-init.c b/gcc/loop-init.c index b1954ca..f754938 100644 --- a/gcc/loop-init.c +++ b/gcc/loop-init.c @@ -186,7 +186,7 @@ fix_loop_structure (bitmap changed_bbs) int record_exits = 0; loop_iterator li; struct loop *loop; - unsigned old_nloops; + unsigned old_nloops, i; timevar_push (TV_LOOP_INIT); @@ -230,8 +230,9 @@ fix_loop_structure (bitmap changed_bbs) flow_loop_tree_node_add (loop_outer (loop), ploop); } - /* Remove the loop and free its data. */ - delete_loop (loop); + /* Remove the loop. */ + loop->header = NULL; + flow_loop_tree_node_remove (loop); } /* Remember the number of loops so we can return how many new loops @@ -253,6 +254,14 @@ fix_loop_structure (bitmap changed_bbs) } } + /* Finally free deleted loops. */ + FOR_EACH_VEC_ELT (*get_loops (), i, loop) + if (loop && loop->header == NULL) + { + (*get_loops ())[i] = NULL; + flow_loop_free (loop); + } + loops_state_clear (LOOPS_NEED_FIXUP); /* Apply flags to loops. */ |