From d0569f9fd3d445ceb0235abafeae6e08143b67c5 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Fri, 16 May 2008 08:38:12 +0000 Subject: [PATCH] tree-ssa-propagate.c (substitute_and_fold): Fix stmt walking on deletion of the last stmt. 2008-05-16 Richard Guenther * tree-ssa-propagate.c (substitute_and_fold): Fix stmt walking on deletion of the last stmt. From-SVN: r135412 --- gcc/ChangeLog | 5 +++++ gcc/tree-ssa-propagate.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 77b9620b059..71edc978a2f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-05-16 Richard Guenther + + * tree-ssa-propagate.c (substitute_and_fold): Fix stmt walking + on deletion of the last stmt. + 2008-05-15 H.J. Lu * config/i386/i386.c (ix86_expand_vector_init_general): Optimize diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 1b40bf095ed..728a709c64c 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -1250,6 +1250,7 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p) && (!(call = get_call_expr_in (stmt)) || !TREE_SIDE_EFFECTS (call))) { + block_stmt_iterator i2; if (dump_file && dump_flags & TDF_DETAILS) { fprintf (dump_file, "Removing dead stmt "); @@ -1257,10 +1258,10 @@ substitute_and_fold (prop_value_t *prop_value, bool use_ranges_p) fprintf (dump_file, "\n"); } prop_stats.num_dce++; - bsi_remove (&i, true); + bsi_prev (&i); + i2 = bsi_for_stmt (stmt); + bsi_remove (&i2, true); release_defs (stmt); - if (!bsi_end_p (i)) - bsi_prev (&i); continue; } -- 2.30.2