https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97793
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The reason for that is that for static functions it is the FE that emits the warnings and doesn't have the ability to check for fallthrough into the end of function being unreachable, while for public functions it is only the middle-end (after cfg is created, so has the ability to check that). The C++ FE does it very similarly, but since PR55189 it has some quick infinite loops check, to cite Jason: > To avoid spurious warnings on code with infinite loops we could add a > > simple check for infinite loops and suppress the warning in that case. > > Basically, if we see a loop with an always-true condition and no breaks. > Not sure how hard would it be to add similar tracking of infinite loops to the C FE.