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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I'm pretty sure what the docs mean is that the compiler will not optimise the
caller to assume that anything passed to the function is non-null. Inside the
function it will still assume the parameter is never null.

So by default the null check here can be removed:

void f(char* p) {
  isnull(p);
  if (p)
    puts(p);
}

The puts call will be done unconditionally, because using p as the argument to
isnull implies it is not null, so the check is redundant.

The option prevents the if (p) check being removed.

Reply via email to