[Bug other/81582] -Wimplicit-fallthrough= wrong warning with -save-temps
gjl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 27 17:52:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81582
--- Comment #9 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
With -fdirectives-only locations go bananas:
#include <stdio.h>
int f1 (int x)
{
switch (x)
{
case 1: x++; // FALLTHRU
case 2: x--; /* FALLTHRU */
case 3: x++; // line #9
case 4: return x;
default:
break;
}
return 0;
} // line #15
$ gcc foo.c -W -save-temps -S -fdirectives-only
foo.c: In function 'f1':
foo.c:16:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
^
foo.c:18:5: note: here
^
The case 1/2 warnings are silenced, but the (correct) warning for case 3 is
thrown at lines 16 and 18 for a file with only 15 source lines.
More information about the Gcc-bugs
mailing list