https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83429
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|ASSIGNED |RESOLVED --- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> --- GCC 11 and 12 print the following for the test case in comment #0. I believe the problem has been resolved (the %G format is gone now from 12). pr83429.c: In function ‘void test(S*)’: pr83429.c:12:42: warning: ‘%s’ directive output may be truncated writing up to 9 bytes into a region of size between 5 and 14 [-Wformat-truncation=] 12 | snprintf(s->out, sizeof(s->out), "%s.%s", s->str1, s->str2); // line 12 | ^~ pr83429.c:12:13: note: ‘snprintf’ output between 2 and 20 bytes into a destination of size 15 12 | snprintf(s->out, sizeof(s->out), "%s.%s", s->str1, s->str2); // line 12 | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~