https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81275
Bug ID: 81275 Summary: [gcc7 gcc8] -fsanitize=thread produce incorrect -Wreturn-type warning Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: dimhen at gmail dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone: --- g++ -Werror=return-type -c t.cpp # no warning g++ -Werror=return-type -fsanitize=thread -c t.cpp # warning t.cpp:14:1: error: control reaches end of non-void function [-Werror=return-type] } ^ Affected versions: gcc version 7.0.1 20170420 (experimental) [trunk revision 247015] (GCC) gcc version 8.0.0 20170625 (experimental) [trunk revision 249632] (GCC) -fsanitize={address,undefined} unaffected $ cat t.cpp int f1(int a, int b) { switch (a) { case 0: switch (b) { default: return 0; } break; // NO warning if commented out default: return 0; } }