https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100605
Bug ID: 100605 Summary: -Wimplicit-fallthrough=5 still recognizes comments Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: tuliom at ascii dot art.br Target Milestone: --- According to the GCC manual: "-Wimplicit-fallthrough=5 doesn’t recognize any comments as fallthrough comments, only attributes disable the warning." However, comments are still being recognized and are disabling the warning. In the following example, there are 3 fall-throughs: $ cat t.c #include <stddef.h> #include <inttypes.h> uint32_t foo(size_t in) { uint32_t out = 0; uint32_t k = 0; switch (in & 3) { case 3: k = 3; // FALLTHROUGH case 2: k = 8; case 1: k = 16; case 0: default: out = k; break; } return out; } However, GCC 11 reports only 2 when using -Wimplicit-fallthrough=5: $ gcc-11 -c -Wimplicit-fallthrough=5 -Werror=implicit-fallthrough t.c t.c: In function ‘foo’: t.c:15:9: error: this statement may fall through [-Werror=implicit-fallthrough=] 15 | k = 8; | ~~^~~ t.c:16:5: note: here 16 | case 1: | ^~~~ t.c:17:9: error: this statement may fall through [-Werror=implicit-fallthrough=] 17 | k = 16; | ~~^~~~ t.c:18:5: note: here 18 | case 0: | ^~~~ cc1: some warnings being treated as errors