This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/51896] Should gcc warn if a variable initializer inside a switch statement is never used?
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 19 Jan 2012 10:04:01 +0000
- Subject: [Bug c/51896] Should gcc warn if a variable initializer inside a switch statement is never used?
- Auto-submitted: auto-generated
- References: <bug-51896-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51896
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-01-19
Ever Confirmed|0 |1
Severity|normal |enhancement
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-19 10:04:01 UTC ---
Confirmed. This is similar to
int
main(int argc, char *argv[])
{
goto _default;
{
int *b = (int*)0xbbbbbbbb;
_default:
printf("b is: %p\n", b);
}
return 0;
}
thus, when you jump across an init expression and still use the variable.