re PR middle-end/10336 (ICE with -Wunreachable-code)
authorJason Merrill <jason@redhat.com>
Tue, 29 Apr 2003 20:25:11 +0000 (16:25 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 29 Apr 2003 20:25:11 +0000 (16:25 -0400)
        PR middle-end/10336
        * jump.c (never_reached_warning): Really stop looking if we reach
        the beginning of the function.

From-SVN: r66249

gcc/ChangeLog
gcc/jump.c

index c22b671de013b9af8b04f4d818181bb89c12bf6a..b7bb449594ec87b79786c93be9ae3b927b2800f1 100644 (file)
@@ -1,3 +1,9 @@
+2003-04-29  Jason Merrill  <jason@redhat.com>
+
+       PR middle-end/10336
+       * jump.c (never_reached_warning): Really stop looking if we reach 
+       the beginning of the function.
+
 2003-04-29  Bob Wilson  <bob.wilson@acm.org>
 
        * config/xtensa/elf.h (SIZE_TYPE, PTRDIFF_TYPE, USER_LABEL_PREFIX):
index 5563ee34581a93d919b66ed36e6a039f4f07c212..5bed408fb5ca1de76e56513bf81b7198111ed004 100644 (file)
@@ -1912,13 +1912,15 @@ never_reached_warning (avoided_insn, finish)
   /* Back up to the first of any NOTEs preceding avoided_insn; flow passes
      us the head of a block, a NOTE_INSN_BASIC_BLOCK, which often follows
      the line note.  */
-  for (insn = PREV_INSN (avoided_insn); ; insn = PREV_INSN (insn))
-    if (GET_CODE (insn) != NOTE
-       || NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG)
-      {
-       insn = NEXT_INSN (insn);
+  insn = avoided_insn;
+  while (1)
+    {
+      rtx prev = PREV_INSN (insn);
+      if (prev == NULL_RTX
+         || GET_CODE (prev) != NOTE)
        break;
-      }
+      insn = prev;
+    }
 
   /* Scan forwards, looking at LINE_NUMBER notes, until we hit a LABEL
      in case FINISH is NULL, otherwise until we run out of insns.  */