[Bug c++/106965] g++ optimization removes assigning 0 to deleted pointer- causes double free.
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Sep 19 11:29:17 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106965
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think it's undefined to invoke a DTOR twice which is what you do here. After
the DTOR the m_ptr member becomes undefined so re-evaluating that in the second
invocation (when there's no object of type X anymore) is undefined.
More information about the Gcc-bugs
mailing list