OSDN Git Service

Jeffrey A Law (law@cygnus.com)
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Oct 1999 04:12:33 +0000 (04:12 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Oct 1999 04:12:33 +0000 (04:12 +0000)
        * flow.c (merge_blocks): Avoid assing BASIC_BLOCK for non-existent
        blocks.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29820 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/flow.c

index 581a6ff..38dfc24 100644 (file)
@@ -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.
index 4244335..f883d80 100644 (file)
@@ -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.  */