[Bug middle-end/92943] missing -Wformat-overflow with an allocated buffer with non-constant size in known range
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 23 07:40:01 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92943
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.3.0
Known to work| |11.1.0
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2021-12-23
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This seems fixed in GCC 11+:
<source>: In function 'h':
<source>:23:26: warning: '%i' directive writing 5 bytes into a region of size 4
[-Wformat-overflow=]
23 | __builtin_sprintf (p, "%i", 12345); // overflow not detected
| ^~
<source>:23:3: note: '__builtin_sprintf' output 6 bytes into a destination of
size 4
23 | __builtin_sprintf (p, "%i", 12345); // overflow not detected
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Gcc-bugs
mailing list