]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
jump.c (never_reached_warning): Really stop looking if we reach the beginning of...
authorJason Merrill <jason@redhat.com>
Tue, 29 Apr 2003 20:25:48 +0000 (16:25 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 29 Apr 2003 20:25:48 +0000 (16:25 -0400)
        * jump.c (never_reached_warning): Really stop looking if we reach
        the beginning of the function.

From-SVN: r66250

gcc/ChangeLog
gcc/jump.c

index 76d7c35bbc3dcf1cb2994928fac88ac57de5e25e..49adc796b62f9ed0489637d71097dac5a1ab9354 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-22  Release Manager
 
        * GCC 3.2.3 Released.
index c668374af879ceda197c0190e9c1150a08b33112..3fac7a561d4243b209acc2bf4261f435ea943f22 100644 (file)
@@ -1957,13 +1957,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.  */