I would expect gcc to issue the same or similar warning for both functions below but the unreachable label in the switch statement isn't flagged even with -Wall.
In addition, a new portability warning mode/option would be useful that would point out cases like those below irrespective of -funsigned-char or other such options. $ cat t.c && gcc -Wall -c -funsigned-char t.c int foo (char c) { switch (c) { case -1: return -1; }; return 0; } int bar (char c) { if (c == -1) return -1; return 0; } t.c: In function `bar': t.c:9: warning: comparison is always false due to limited range of data type -- Summary: missing limited range warning for a switch statement Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sebor at roguewave dot com GCC build triplet: all GCC host triplet: all GCC target triplet: all http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30020