[Bug c/82206] New: -Wformat-nonliteral does not warn when passing a non literal to vprintf
simon.marchi at polymtl dot ca
gcc-bugzilla@gcc.gnu.org
Wed Sep 13 21:32:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82206
Bug ID: 82206
Summary: -Wformat-nonliteral does not warn when passing a non
literal to vprintf
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: simon.marchi at polymtl dot ca
Target Milestone: ---
Created attachment 42165
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42165&action=edit
Reproducer
I have extracted this small snippet (see attached file) from the
microblaze-tdep.c source file in GDB. clang gives this warning when passing a
non literal to vprintf:
$ clang-4.0 test.c -Wformat -Wformat-nonliteral
test.c:10:12: warning: format string is not a string literal
[-Wformat-nonliteral]
vprintf (fmt, args);
^~~
1 warning generated.
gcc 7.2 with the same arguments does not emit any warning. Would it make sense
for gcc to also emit it?
More information about the Gcc-bugs
mailing list