summaryrefslogtreecommitdiff
path: root/gcc/jump.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-12 21:39:42 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-12 21:39:42 +0000
commit5b154f0470b61a0eb8548df5057d68a97f26485c (patch)
treec47e31ee211f6ebb4c3412768ea592590252152c /gcc/jump.c
parentb5e38ce9646f114048c1f67fa9950b5aad1f0039 (diff)
downloadgcc-5b154f0470b61a0eb8548df5057d68a97f26485c.tar.gz
* jump.c (never_reached_warning): Add finish argument.
If finish is NULL, stop on CODE_LABEL, otherwise stop before first real insn after end. * rtl.h (never_reached_warning): Adjust prototype. * cse.c (cse_insn): Pass NULL as finish to never_reached_warning. * cfgrtl.c (flow_delete_block): Pass b->end as finish to never_reached_warning. * gcc.dg/Wunreachable-1.c: New test. * gcc.dg/Wunreachable-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49713 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/jump.c')
-rw-r--r--gcc/jump.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/gcc/jump.c b/gcc/jump.c
index fcb3c61800b..fc6bef07e48 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1913,13 +1913,12 @@ delete_for_peephole (from, to)
so it's possible to get spurious warnings from this. */
void
-never_reached_warning (avoided_insn)
- rtx avoided_insn;
+never_reached_warning (avoided_insn, finish)
+ rtx avoided_insn, finish;
{
rtx insn;
rtx a_line_note = NULL;
- int two_avoided_lines = 0;
- int contains_insn = 0;
+ int two_avoided_lines = 0, contains_insn = 0, reached_end = 0;
if (! warn_notreached)
return;
@@ -1929,10 +1928,11 @@ never_reached_warning (avoided_insn)
for (insn = avoided_insn; insn != NULL; insn = NEXT_INSN (insn))
{
- if (GET_CODE (insn) == CODE_LABEL)
+ if (finish == NULL && GET_CODE (insn) == CODE_LABEL)
break;
- else if (GET_CODE (insn) == NOTE /* A line number note? */
- && NOTE_LINE_NUMBER (insn) >= 0)
+
+ if (GET_CODE (insn) == NOTE /* A line number note? */
+ && NOTE_LINE_NUMBER (insn) >= 0)
{
if (a_line_note == NULL)
a_line_note = insn;
@@ -1941,7 +1941,14 @@ never_reached_warning (avoided_insn)
!= NOTE_LINE_NUMBER (insn));
}
else if (INSN_P (insn))
- contains_insn = 1;
+ {
+ if (reached_end)
+ break;
+ contains_insn = 1;
+ }
+
+ if (insn == finish)
+ reached_end = 1;
}
if (two_avoided_lines && contains_insn)
warning_with_file_and_line (NOTE_SOURCE_FILE (a_line_note),