https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80147
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |WONTFIX Status|NEW |RESOLVED CC| |msebor at gcc dot gnu.org --- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> --- Eric explained the reason for the missing warning with -O1 in the test case in comment #0. The code in the test case in comment #3 is folded away very early on so there's nothing for the warning to complain about. My guess is that Clang warns during parsing. GCC much later on, to avoid warning for dead code. It's a deliberate decision. I don't think there's anything to fix here.