This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/25314] [4.2/4.3/4.4 Regression] Unreachable code at beginning of switch statement is not reported anymore
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Dec 2008 08:45:49 -0000
- Subject: [Bug c/25314] [4.2/4.3/4.4 Regression] Unreachable code at beginning of switch statement is not reported anymore
- References: <bug-25314-7407@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #11 from jakub at gcc dot gnu dot org 2008-12-11 08:45 -------
You do not to warn for:
void foo (int c)
{
int a;
switch (c)
{
foo:
a = 1;
break;
case 5:
goto foo;
}
}
(any label should stop the search).
You ICE on:
void foo (int c)
{
switch (c)
{
int a;
case 5:
a = 1;
break;
}
}
plus the CASE_LABEL_EXPR (or LABEL_EXPR) can be nested in arbitrary amount of
STATEMENT_LIST/BIND_EXPRs (not sure about e.g. try blocks etc.).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25314