https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71892
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- -fno-delete-null-pointer-checks For the not deleting null pointer checks. The other bug report has the other option specified already. C++ and C have undefined behavior in them. Learning this for the first time sometimes can be a shock but once you learn the optimizing compiler optimizes code better you will understand why. Also For the null pointer check, you can use -fsantizer=undefined to find the undefined behavior in your code.