[Bug c/30020] improve diagnostics for limited range warning for a switch statement
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri May 30 13:58:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30020
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-05-30
CC| |manu at gcc dot gnu.org
Summary|missing limited range |improve diagnostics for
|warning for a switch |limited range warning for a
|statement |switch statement
Ever confirmed|0 |1
--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
GCC now warns by default for this, but the location sucks.
test.c: In function ‘foo’:
test.c:3:3: warning: case label value is less than minimum value for type
switch (c) { case -1: return -1; };
^
It would be nice if it said which type.
Clang says:
test.c:3:21: warning: overflow converting case value to switch condition type
(-1 to 255) [-Wswitch]
switch (c) { case -1: return -1; };
^
More information about the Gcc-bugs
mailing list