http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60439
Bug ID: 60439 Summary: No warning for case overflow in switch statement. Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com For the switch statement in the function f2, the controlling expression is either 1 or 0, and the first "case 1111" exceeds the max value. $: cat s.c int f1(char c) { switch(c) { case 111111: return 1; /*warning here*/ default: return 0; } } int f2(char c, char d) { switch(c && d) { case 1111: return 1; /*no warning here*/ default: return 0; } } $: gcc-trunk -c s.c s.c: In function ‘f1’: s.c:3:3: warning: case label value exceeds maximum value for type case 111111: return 1; /*warning here*/ ^