https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90535 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- -fno-delete-null-pointer-checks is the correct option. https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Optimize-Options.html#index-fdelete-null-pointer-checks