https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87773
Bug ID: 87773
Summary: %s directive argument is null missing inlining context
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
The warning below is missing inlining context. Worse, because it points to the
format string rather than the call, in complex code it could be tricky to
figure out where it's coming from.
Finally, it should probably be controlled by -Wnonnull like other such
warnings.
$ cat t.c && gcc -O2 -S -Wall t.c
void f (char *d, const char *f, const char *p)
{
__builtin_sprintf (d, f, p);
}
void g (char *d)
{
const char *f = "%s";
__builtin_sprintf (d, f, 0);
}
t.c: In function āgā:
t.c:8:20: warning: ā%sā directive argument is null [-Wformat-overflow=]
8 | const char *f = "%s";
| ^~