From: Jeffrey A Law Date: Tue, 5 Oct 1999 04:12:33 +0000 (+0000) Subject: Jeffrey A Law (law@cygnus.com) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff54d46bc942630f0f76f093d7cc4d2e9b5b7c70;p=gcc.git Jeffrey A Law (law@cygnus.com) * flow.c (merge_blocks): Avoid assing BASIC_BLOCK for non-existent blocks. From-SVN: r29820 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 581a6ff0840..38dfc2433c9 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 * toplev.c (dbr_sched_time): Unconditional. diff --git a/gcc/flow.c b/gcc/flow.c index 4244335c880..f883d80c520 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. */