aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2003-04-03 20:21:56 -0500
committerJason Merrill <jason@gcc.gnu.org>2003-04-03 20:21:56 -0500
commited2e5902ab2f6fc4203883ee33f010d814c8868a (patch)
treeae1ea1dc2bebea2da16c63c26850e910f8520487 /gcc
parentbc349178ee3f7cae0a82a44328679f018797bf4b (diff)
downloadgcc-ed2e5902ab2f6fc4203883ee33f010d814c8868a.zip
gcc-ed2e5902ab2f6fc4203883ee33f010d814c8868a.tar.gz
gcc-ed2e5902ab2f6fc4203883ee33f010d814c8868a.tar.bz2
re PR c/10175 (-Wunreachable-code doesn't work for single lines)
PR c/10175 * jump.c (never_reached_warning): Revert patch of 2002-11-02. Look backwards for a line note. From-SVN: r65227
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/jump.c14
2 files changed, 18 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 616b1a0..b890b9c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2003-04-03 Jason Merrill <jason@redhat.com>
+
+ PR c/10175
+ * jump.c (never_reached_warning): Revert patch of 2002-11-02.
+ Look backwards for a line note.
+
2003-04-03 Neil Booth <neil@daikokuya.co.uk>
* fix-header.c (read_scan_file): Defer switch processing.
diff --git a/gcc/jump.c b/gcc/jump.c
index 6e04790..b48bc6b 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1909,10 +1909,20 @@ never_reached_warning (avoided_insn, finish)
if (!warn_notreached)
return;
+ /* 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)
+ {
+ insn = NEXT_INSN (insn);
+ break;
+ }
+
/* Scan forwards, looking at LINE_NUMBER notes, until we hit a LABEL
in case FINISH is NULL, otherwise until we run out of insns. */
- for (insn = avoided_insn; insn != NULL; insn = NEXT_INSN (insn))
+ for (; insn != NULL; insn = NEXT_INSN (insn))
{
if ((finish == NULL && GET_CODE (insn) == CODE_LABEL)
|| GET_CODE (insn) == BARRIER)
@@ -1929,7 +1939,7 @@ never_reached_warning (avoided_insn, finish)
}
else if (INSN_P (insn))
{
- if (reached_end || a_line_note == NULL)
+ if (reached_end)
break;
contains_insn = 1;
}