re PR c/10175 (-Wunreachable-code doesn't work for single lines)
authorRoger Sayle <roger@eyesopen.com>
Thu, 17 Apr 2003 01:22:51 +0000 (01:22 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Thu, 17 Apr 2003 01:22:51 +0000 (01:22 +0000)
commit96c6931df4d8809e4adf59a64977ac3889f6560b
tree44b4d881f76561d90d3775b429d23bd5cec3c3fa
parent3568b0ef3daa7aabadde5d9124a1a85668b0bc7e
re PR c/10175 (-Wunreachable-code doesn't work for single lines)

2003-04-16  Roger Sayle  <roger@eyesopen.com>

* c-semantics.c (find_reachable_label): New function to find a
potentially reachable label in an expression.
(expand_unreachable_if_stmt): Similar to expand_if_stmt but
assumes the start of the IF_STMT is unreachable (dead) code.
(expand_unreachable_stmt): Similar to expand_stmt but assumes
the start of the statement list is unreachable (dead) code.
(genrtl_if_stmt):  If the controlling expression of the IF
is constant, use expand_unreachable_stmt for the THEN or ELSE
clause as appropriate.
(genrtl_switch_stmt):  Use expand_unreachable_stmt to expand
the body of a SWITCH statement.
(expand_stmt): The code immediately following a "return",
"break", "continue" or "goto" is unreachable.
* Makefile.in (c-semantics.o): Depend upon tree-inline.h.

* gcc.dg/Wunreachable-5.c: New test case for PR c/10175.
* gcc.c-torture/execute/medce-1.c: New test case.
* gcc.c-torture/execute/medce-2.c: New test case.

From-SVN: r65715
gcc/ChangeLog
gcc/Makefile.in
gcc/c-semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/medce-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/medce-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wunreachable-5.c [new file with mode: 0644]