https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111513
--- Comment #4 from Thomas Weißschuh <g...@t-8ch.de> --- Thanks for the quick response Andrew! I'll probably disable -Werror then. FYI: If I drop the `#include <libintl.h>` and instead declare `dcgettext` on my own, adding `__attribute__((returns_nonnull)), the issue persists. Maybe the special handling for gettext() in GCC with regards to format_arg conflicts here. /* test.c * * compile with: * gcc -Wall -fsanitize=undefined -O2 test.c */ #include <stdio.h> __attribute__((format_arg(2), returns_nonnull)) extern char *dcgettext (const char *__domainname, const char *__msgid, int __category); int main(void) { FILE *out = stdout; fputs("\n", out); printf(dcgettext(NULL, "foo\n", 0)); fputs("\n", out); } $ gcc -Wall -fsanitize=undefined -O2 test.c -Wextra test.c: In function ‘main’: test.c:16:9: warning: null format string [-Wformat-overflow=] 16 | printf(dcgettext(NULL, "foo\n", 0)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test.c:16:9: warning: null format string [-Wformat-overflow=]