https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64150
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- <bb 2>: p1 = makePimpled (); [return slot optimization] _7 = p1.d; p2.d = _7; p1.d = 0B; if (_7 != 0B) goto <bb 3>; else goto <bb 4>; <bb 3>: Pimpled::destroy (&p2); <bb 4>: p2 ={v} {CLOBBER}; _3 = p1.d; if (_3 != 0B) there is nothing that prevents makePimpled from storing a reference to p1 somewhere where Pimpled::destroy could modify it. Thus it is not valid to assume that p1.d is still null at the if.