https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119169
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- What gcc are you using? With current trunk I get ~/src/gcc/obj26/gcc/xgcc -B ~/src/gcc/obj26/gcc/ -fanalyzer pr119169.c -isystem include/ -S pr119169.c: In function ‘main’: pr119169.c:11:3: warning: use of possibly-NULL ‘p’ where non-null expected [CWE-690] [-Wanalyzer-possible-null-argument] 11 | f (p); // -Wanalyzer-possible-null-argument | ^~~~~ ‘main’: events 1-2 10 | p = malloc (1); | ^~~~~~~~~~ | | | (1) this call could return NULL 11 | f (p); // -Wanalyzer-possible-null-argument | ~~~~~ | | | (2) ⚠️ argument 1 (‘p’) from (1) could be NULL where non-null expected pr119169.c:3:23: note: argument 1 of ‘f’ must be non-null 3 | [[gnu::nonnull]] void f (void *); | ^ pr119169.c:15:3: warning: use of possibly-NULL ‘p’ where non-null expected [CWE-690] [-Wanalyzer-possible-null-argument] 15 | g (p, 1); | ^~~~~~~~ ‘main’: events 1-3 10 | p = malloc (1); | ^~~~~~~~~~ | | | (1) this call could return NULL ...... 14 | p = malloc (1); | ~~~~~~~~~~ | | | (2) this call could return NULL 15 | g (p, 1); | ~~~~~~~~ | | | (3) ⚠️ argument 1 (‘p’) from (2) could be NULL where non-null expected pr119169.c:4:40: note: argument 1 of ‘g’ must be non-null 4 | [[gnu::nonnull_if_nonzero(1, 2)]] void g (void *, int); | ^