https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79152
Bug ID: 79152
Summary: -Wimplicit-fallthrough false positive triggered by
goto statements
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: sirl at gcc dot gnu.org
Target Milestone: ---
This strange creduce'd testcase warns with current trunk:
typedef struct {
char * bs;
} xstruct;
void test (char ch, long handle) {
switch (ch) {
case 1:
goto label1;
goto label;
(ch) = *(((xstruct *) (handle))->bs++);
label:
label1:
((xstruct *) handle)->bs ;
}
}
# gcc-trunk -c -Wimplicit-fallthrough testcase.c
testcase.c: In function 'test':
testcase.c:10:14: warning: this statement may fall through
[-Wimplicit-fallthrough=]
(ch) = *(((xstruct *) (handle))->bs++);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
testcase.c:11:1: note: here
label:
^~~~~
I believe this is a false positive. I hope the creduce'd testcase is enough to
highlight the problem.