https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94313
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Removing invalid code not isn't wrong (as in non-conforming), but it's decidedly unhelpful in avoiding the undefined behavior that doesn't necessarily go away just because the invalid statement is gone. It makes finding the underlying bugs difficult. My solution for pr90404 detects most of these bugs (and can also eliminate the buggy code) except those that are removed by DSE. The intent of this report isn't so much to complain that GCC is doing something wrong but to document the rationale for doing something different (i.e., diagnose these bugs consistently and leave it up to the user whether to eliminate the code or replace it with a trap or something else).