https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120278
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Dead branches and dead code definitely appear in -O0 code just about everywhere, that is not about correctness but about efficiency, which is a non-goal for -O0. Even at higher optimization levels compiler can't guarantee there are no dead branches or no dead code, but optimizations try hard to remove it. But when choosing -O0 you've asked the compiler to compile quickly...