https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77799
--- Comment #2 from Martin Sebor ---
This bug was fixed along with the related pr77671 in r248035. GCC 8.0 now
prints the following:
.c: In function ‘g’:
a.c:14:15: warning: too many arguments for format [-Wformat-extra-args]
sprintf (d, "123", 0);
^
a.c: In function ‘f’:
a.c:9:18: warning: ‘123’ directive writing 3 bytes into a region of size 2
[-Wformat-overflow=]
sprintf (d, "123");
~~^
a.c:9:3: note: ‘sprintf’ output 4 bytes into a destination of size 2
sprintf (d, "123");
^~
;; Function f (f, funcdef_no=0, decl_uid=1819, cgraph_uid=0, symbol_order=1)
f ()
{
[100.00%] [count: INV]:
sprintf (&d, "123"); [tail call]
return;
}
a.c: In function ‘g’:
a.c:14:18: warning: ‘123’ directive writing 3 bytes into a region of size 2
[-Wformat-overflow=]
sprintf (d, "123", 0);
~~^
a.c:14:3: note: ‘sprintf’ output 4 bytes into a destination of size 2
sprintf (d, "123", 0);
^
;; Function g (g, funcdef_no=1, decl_uid=1822, cgraph_uid=1, symbol_order=2)
g ()
{
[100.00%] [count: INV]:
sprintf (&d, "123", 0); [tail call]
return;
}