I found you can control this with -f{no-,}delete-null-pointer-checks. Apparently it's enabled by -O2.
http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/Optimize-Options...