https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96739
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- The warning is issued as a result of the if statement in help_oneline. Since cmd is passed ct->name, if cmd is null then so is ct->name (see below). Perhaps you went too far in reducing the test case? $ cat pr96739.c && gcc -O2 -S -Wall pr96739.c typedef struct cmdinfo { const char *name; } cmdinfo_t; ; cmdinfo_t *cmdtab; int ncmds; static void help_oneline(const char *cmd, const cmdinfo_t *ct) { if (cmd) { } else { __builtin_printf("%s ", ct->name); } } void help_all(void) { const cmdinfo_t *ct; for (ct = cmdtab; ct < &cmdtab[ncmds]; ct++) help_oneline (ct->name, ct); } In function ‘help_oneline’, inlined from ‘help_all’ at pr96739.c:17:5: pr96739.c:11:5: warning: ‘%s’ directive argument is null [-Wformat-overflow=] 11 | __builtin_printf("%s ", ct->name); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~