public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/27126] New: -Wswitch-enums doesn't detect impossible cases in switch()
@ 2006-04-12 8:05 ramune+gcc at net-ronin dot org
2006-04-12 10:17 ` [Bug c/27126] " rguenth at gcc dot gnu dot org
2006-04-13 1:27 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: ramune+gcc at net-ronin dot org @ 2006-04-12 8:05 UTC (permalink / raw)
To: gcc-bugs
Given:
int main(void)
{
enum foo { A, B, C, D} bar;
bar = D;
if(bar == A) {
;
} else if(bar == B) {
;
} else {
switch(bar) {
case C:
case D:
;
}
}
return 0;
}
barbeque/zarathustra:src: /usr/local/bin/gcc-4.1.0 -Wswitch-enum a.c
a.c: In function 'main':
a.c:10: warning: enumeration value 'A' not handled in switch
a.c:10: warning: enumeration value 'B' not handled in switch
A & B aren't valid targets for the switch statement by the time it's hit as
they have been handled by the if statements above.
Locally built gcc:
barbeque/zarathustra:src: /usr/local/bin/gcc-4.1.0 -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.1.0/configure --prefix=/usr/local/stow/gcc-4.1.0
--enable-languages=c,c++,objc --infodir=/usr/local/stow/gcc-4.1.0/share/info
--mandir=/usr/local/stow/gcc-4.1.0/share/man --enable-shared --enable-threads
--enable-tls --program-suffix=-4.1.0 --enable-__cxa_atexit
--enable-version-specific-runtime-libs
--enable-targets=x86_64-unknown-linux-gnu --enable-bootstrap=lean
--disable-biarch --disable-multilib
Thread model: posix
gcc version 4.1.0
On Debian/stable from amd64.debian.net.
Also happens on gcc 3.3.5 from the Debian apt archives.
--
Summary: -Wswitch-enums doesn't detect impossible cases in
switch()
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ramune+gcc at net-ronin dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27126
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/27126] -Wswitch-enums doesn't detect impossible cases in switch()
2006-04-12 8:05 [Bug c/27126] New: -Wswitch-enums doesn't detect impossible cases in switch() ramune+gcc at net-ronin dot org
@ 2006-04-12 10:17 ` rguenth at gcc dot gnu dot org
2006-04-13 1:27 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-04-12 10:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2006-04-12 10:17 -------
Confirmed. But this is unlikely to be fixed as it would require moving the
diagnostic to the middle-end where this information is available. And
diagosticts from the middle-end are notoriously frowned upon.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
GCC build triplet|x86_64-unknown-linux-gnu |
GCC host triplet|x86_64-unknown-linux-gnu |
GCC target triplet|x86_64-unknown-linux-gnu |
Keywords| |diagnostic
Priority|P3 |P5
Last reconfirmed|0000-00-00 00:00:00 |2006-04-12 10:17:19
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27126
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/27126] -Wswitch-enums doesn't detect impossible cases in switch()
2006-04-12 8:05 [Bug c/27126] New: -Wswitch-enums doesn't detect impossible cases in switch() ramune+gcc at net-ronin dot org
2006-04-12 10:17 ` [Bug c/27126] " rguenth at gcc dot gnu dot org
@ 2006-04-13 1:27 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-13 1:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-04-13 01:27 -------
*** This bug has been marked as a duplicate of 23577 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27126
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-04-13 1:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-12 8:05 [Bug c/27126] New: -Wswitch-enums doesn't detect impossible cases in switch() ramune+gcc at net-ronin dot org
2006-04-12 10:17 ` [Bug c/27126] " rguenth at gcc dot gnu dot org
2006-04-13 1:27 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).