On 16/06/2021 18:59, Segher Boessenkool wrote: > On Wed, Jun 16, 2021 at 02:01:05PM +0100, Jonny Grant wrote: >> I guess a separate static analyser would do it, GCC is more focused on compilation so I shouldn't ask for it to have so many features it can't support. > > -fsanitize=undefined already catches null pointer dereferences, is that > enough for your case? > > > Segher Hello Thank you for the suggestion, yes, I had used that before. I did just check, it's runtime checks. I had hoped for something at compile time. warning for every function that didn't check pointer for NULL before de-referencing. $ ./null null.c:7:5: runtime error: load of null pointer of type 'int' Segmentation fault (core dumped) // gcc -Wall -fsanitize=undefined -o null null.c #include <stdio.h> void f(int * p) { printf("%d\n", *p); } int main() { f(NULL); }