This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR42229
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 2 Dec 2009 16:18:52 +0100 (CET)
- Subject: [PATCH] Fix PR42229
This avoids cancelling loops after they have been freed and
possibly garbage collected. There is no reason to not
cancel loops immediately when walking the BBs we are about
to remove, so this is what the patch does.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to
trunk.
Richard.
2009-12-02 Richard Guenther <rguenther@suse.de>
PR middle-end/42229
* cfgloopmanip.c (remove_path): Avoid cancelling loops
twice.
Index: gcc/cfgloopmanip.c
===================================================================
*** gcc/cfgloopmanip.c (revision 154907)
--- gcc/cfgloopmanip.c (working copy)
*************** remove_path (edge e)
*** 278,287 ****
edge ae;
basic_block *rem_bbs, *bord_bbs, from, bb;
VEC (basic_block, heap) *dom_bbs;
! int i, nrem, n_bord_bbs, nreml;
sbitmap seen;
bool irred_invalidated = false;
- struct loop **deleted_loop;
if (!can_remove_branch_p (e))
return false;
--- 278,286 ----
edge ae;
basic_block *rem_bbs, *bord_bbs, from, bb;
VEC (basic_block, heap) *dom_bbs;
! int i, nrem, n_bord_bbs;
sbitmap seen;
bool irred_invalidated = false;
if (!can_remove_branch_p (e))
return false;
*************** remove_path (edge e)
*** 342,356 ****
dom_bbs = NULL;
/* Cancel loops contained in the path. */
- deleted_loop = XNEWVEC (struct loop *, nrem);
- nreml = 0;
for (i = 0; i < nrem; i++)
if (rem_bbs[i]->loop_father->header == rem_bbs[i])
! deleted_loop[nreml++] = rem_bbs[i]->loop_father;
!
! for (i = 0; i < nreml; i++)
! cancel_loop_tree (deleted_loop[i]);
! free (deleted_loop);
remove_bbs (rem_bbs, nrem);
free (rem_bbs);
--- 341,349 ----
dom_bbs = NULL;
/* Cancel loops contained in the path. */
for (i = 0; i < nrem; i++)
if (rem_bbs[i]->loop_father->header == rem_bbs[i])
! cancel_loop_tree (rem_bbs[i]->loop_father);
remove_bbs (rem_bbs, nrem);
free (rem_bbs);