diff options
author | Jason Merrill <jason@redhat.com> | 2003-04-15 12:13:14 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2003-04-15 12:13:14 -0400 |
commit | 9547e8fd98c50f8e01cb5d92109a5c7ed6b862dd (patch) | |
tree | f4d3141cda679bb35bf11e4ca06050cea09a777d /gcc | |
parent | 55adc7bd57e426ac615874ce723406e11f341388 (diff) | |
download | gcc-9547e8fd98c50f8e01cb5d92109a5c7ed6b862dd.zip gcc-9547e8fd98c50f8e01cb5d92109a5c7ed6b862dd.tar.gz gcc-9547e8fd98c50f8e01cb5d92109a5c7ed6b862dd.tar.bz2 |
PR middle-end/10336, c++/10401
PR middle-end/10336, c++/10401
* jump.c (never_reached_warning): Also stop looking if we reach the
beginning of the function.
From-SVN: r65637
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/jump.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Wunreachable-4.c | 12 |
3 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2856bc1..e2750ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-04-14 Jason Merrill <jason@redhat.com> + + PR middle-end/10336, c++/10401 + * jump.c (never_reached_warning): Also stop looking if we reach the + beginning of the function. + 2003-04-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> PR target/10338 @@ -1913,7 +1913,8 @@ never_reached_warning (avoided_insn, finish) 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) + if (GET_CODE (insn) != NOTE + || NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG) { insn = NEXT_INSN (insn); break; diff --git a/gcc/testsuite/gcc.dg/Wunreachable-4.c b/gcc/testsuite/gcc.dg/Wunreachable-4.c new file mode 100644 index 0000000..38ae6f8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wunreachable-4.c @@ -0,0 +1,12 @@ +/* PR middle-end/10336 */ +/* { dg-options "-Wunreachable-code" } */ + +void foo(int i) +{ + switch(i) { + case 0: + break; + case 1: + break; + } +} |