[Bug c/93894] -Wimplicit-fallthrough false warning with operator %
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93894 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek --- Yeah, -Wimplicit-fallthrough is intentionally an early warning, so that it isn't dependent on optimizations etc., and you are asking that it depends on VRP or some poor man's VRP. There will always be ways to obfuscate code so that the compiler doesn't understand something can't fall through.
[Bug c/93894] -Wimplicit-fallthrough false warning with operator %
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93894 --- Comment #3 from Andrew Pinski --- The warning is not sensitive to what is being switched on. That is the inner most switch is considered as falling through as the switch is not checked for the values it will be switched on.
[Bug c/93894] -Wimplicit-fallthrough false warning with operator %
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93894 --- Comment #2 from Dmitry G. Dyachenko --- `unsigned' changes nothing $ cat xxu.i int f1(int j, unsigned k) { switch (j) { case 0: switch (k % 2) { case 0: return 0; case 1: return 1; } // return 3; // uncomment to fix warning default: return 2; } } $ gcc -fpreprocessed -Wimplicit-fallthrough=2 -Og -c xxu.i xx.i: In function ‘f1’: xx.i:5:2: warning: this statement may fall through [-Wimplicit-fallthrough=] 5 | switch (k % 2) { | ^~ xx.i:12:5: note: here 12 | default: | ^~~
[Bug c/93894] -Wimplicit-fallthrough false warning with operator %
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93894 --- Comment #1 from Andreas Schwab --- case -1 is missing.