foo (char *x) { char ret = *x; if (x) com(); else bar(); return ret; }
It is expected that the compiler will eliminate the pointer check withthe option '-fdelete-null-pointer-checks' or with >the option -O2, -O3, or -Os.
Hang on, why would it eliminate the null pointer check, if the null pointer check is in the source code? Are you assuming that the compiler knows for certain that x is non zero when it compiles the function?
Richard