https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87041
--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> --- -Wformat-overflow already warns for null pointers. I don't recall any bug reports about it so it shouldn't be too bad. void f (char *d, char *p) { if (p) return; __builtin_sprintf (d, "%s", p); } warning: ā%sā directive argument is null [-Wformat-overflow=] __builtin_sprintf (d, "%s", p);