aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1999-10-05 04:12:33 +0000
committerRichard Henderson <rth@gcc.gnu.org>1999-10-04 21:12:33 -0700
commitff54d46bc942630f0f76f093d7cc4d2e9b5b7c70 (patch)
treee938b1bf8cd1edd56264dd5552b35bcede67242b
parent375e2d5cfa2f952b0da9b057a50fbfa1683f3a5f (diff)
downloadgcc-ff54d46bc942630f0f76f093d7cc4d2e9b5b7c70.zip
gcc-ff54d46bc942630f0f76f093d7cc4d2e9b5b7c70.tar.gz
gcc-ff54d46bc942630f0f76f093d7cc4d2e9b5b7c70.tar.bz2
Jeffrey A Law (law@cygnus.com)
* flow.c (merge_blocks): Avoid assing BASIC_BLOCK for non-existent blocks. From-SVN: r29820
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/flow.c15
2 files changed, 16 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 581a6ff..38dfc24 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Mon Oct 4 21:12:02 1999 Jeffrey A Law (law@cygnus.com)
+
+ * flow.c (merge_blocks): Avoid assing BASIC_BLOCK for non-existent
+ blocks.
+
Mon Oct 4 21:01:39 1999 Richard Henderson <rth@cygnus.com>
* toplev.c (dbr_sched_time): Unconditional.
diff --git a/gcc/flow.c b/gcc/flow.c
index 4244335..f883d80 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -2191,7 +2191,10 @@ merge_blocks (e, b, c)
/* If B does not have an incoming fallthru, and the exception regions
match, then it can be moved immediately before C without introducing
- or modifying jumps. */
+ or modifying jumps.
+
+ C can not be the first block, so we do not have to worry about
+ accessing a non-existent block. */
d = BASIC_BLOCK (c->index - 1);
if (! b_has_incoming_fallthru
&& d->eh_end == b->eh_beg
@@ -2199,10 +2202,14 @@ merge_blocks (e, b, c)
return merge_blocks_move_predecessor_nojumps (b, c);
/* Otherwise, we're going to try to move C after B. Make sure the
- exception regions match. */
- d = BASIC_BLOCK (b->index + 1);
+ exception regions match.
+
+ If B is the last basic block, then we must not try to access the
+ block structure for block B + 1. Luckily in that case we do not
+ need to worry about matching exception regions. */
+ d = (b->index + 1 < n_basic_blocks ? BASIC_BLOCK (b->index + 1) : NULL);
if (b->eh_end == c->eh_beg
- && c->eh_end == d->eh_beg)
+ && (d == NULL || c->eh_end == d->eh_beg))
{
/* If C does not have an outgoing fallthru, then it can be moved
immediately after B without introducing or modifying jumps. */