This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/81582] -Wimplicit-fallthrough= wrong warning with -save-temps
- From: "gjl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 27 Jul 2017 17:52:30 +0000
- Subject: [Bug other/81582] -Wimplicit-fallthrough= wrong warning with -save-temps
- Auto-submitted: auto-generated
- References: <bug-81582-4@http.gcc.gnu.org/bugzilla/>
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.