https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92479
Bug ID: 92479 Summary: missing warnings for unreachable codes with -Wunreachable-code Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: tangyixuan at mail dot dlut.edu.cn Target Milestone: --- Hi, there is no warning for the unreachable code with [-Wunreachable-code] as follow. Would it be better to warn developers if the 'break' branch is unreachable? $ cat s.c int main() { for(int i = 1;; i++){ if(0) break; } } $ gcc -c -Wunreachable-code s.c no warnings. $ gcc -v Target: x86_64-pc-linux-gnu gcc version 10.0.0 20191110 (experimental) (GCC) $ clang -c -Wunreachable-code-break s.c s.c:5:7: warning: 'break' will never be executed [-Wunreachable-code-break] break; ^~~~~ 1 warning generated. Best regards