https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67618
Marc Glisse <glisse at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|middle-end |c --- Comment #7 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to Daniel Gutson from comment #4) > The optimization ignores the 'if' statement (just comment that line and > see), so if malloc() returns NULL, memset is called unconditionally and will > try to write to address NULL. Ah, you are saying that calling memset on a null pointer is not undefined behavior, that it generates an observable trap, and that the transformation should be protected by -fdelete-null-pointer-checks?