http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16351
--- Comment #13 from Jeffrey A. Law <law at redhat dot com> ---
Just adding a quick warning_at at the points where we optimize erroneous uses
of NULL I get:
j.c: In function 'test1':
j.c:10:9: warning: Erroneous NULL pointer use (explicit)
[enabled by default]
s->bar = 1; /* { dg-warning "null" } */
^
j.c: In function 'test2':
j.c:15:20: warning: Erroneous NULL pointer use (explicit)
[enabled by default]
if (s == NULL && s->bar > 2) /* { dg-warning "null" } */
^
j.c: In function 'test3':
j.c:23:20: warning: Erroneous NULL pointer use (explicit)
[enabled by default]
if (s != NULL || s->bar > 2) /* { dg-warning "null" } */
^
j.c:26:9: warning: Erroneous NULL pointer use (explicit)
[enabled by default]
s->bar = 3; /* { dg-warning "null" } */
^
Which is exactly what I would expect.