http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50606
Bug #: 50606 Summary: gcc fails to detect obvious use of NULL pointer Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: dcb...@hotmail.com I just tried the following C code on latest trunk snapshot 20111001 on an AMD x86_64 box. # include <stdio.h> void f( const char * p) { if (p == 0) printf( "Hello world %s\n", p); } The compiler said nothing at all, which was a bit surprising. $ ../results/bin/gcc -g -O2 -Wall -Wextra -pedantic -c bug34.c $ OK, gcc isn't clairvoyant, but a little bit of NULL pointer tracking might be useful, to print out a useful warning message or two.