https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #34 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Manuel López-Ibáñez from comment #27) > (In reply to Manuel López-Ibáñez from comment #25) > > * Cases like: > > > > 1: const str[] = "something %d"; > > 2: printf(str); > > Note that clang is able to handle this: > > manuel@gcc10:~$ clang -Wformat format.c > format.c:4:19: warning: more '%' conversions than data arguments [-Wformat] > __builtin_printf(str); > ^~~ > format.c:3:33: note: format string is defined here > const char str[] = "something %d"; > ~^ Note to myself: Supporting this requires tracking the location of the initializer. Perhaps we could track this explicitly in var_decl. Or by adding an expression around the initializer. Then, we would need to pass the additional location to the point of warning_at, so we can print the note when appropriate.