[Bug c++/106965] g++ optimization removes assigning 0 to deleted pointer- causes double free.

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Sep 20 10:18:29 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106965

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Boaz from comment #4)
> which is a good practice as far as I know.

Not really, because it's dead code and typically optimized away anyway.

It's better to use static analysis tools, or dynamic analysis like ASan.


More information about the Gcc-bugs mailing list