[Bug tree-optimization/88441] missing warning on a buffer overflow with non-constant offset and constant size
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 22 22:17:24 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88441
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |10.0
Target Milestone|--- |10.0
Known to fail| |9.3.0
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Thanks to r279392 GCC 10 detects the certain overflow in g:
pr88441.c: In function ‘g’:
pr88441.c:13:5: warning: writing 8 bytes into a region of size 7
[-Wstringop-overflow=]
13 | __builtin_memcpy (a + i, p, sizeof a); // missing
-Wstringop-overflow
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pr88441.c:1:6: note: at offset 0 to object ‘a’ with size 8 declared here
1 | char a[8];
| ^
It feels like a separate question whether the possible/likely overflow should
also be diagnosed when it's not certain. Diagnosing it would be a design
change for the overflow warnings that are currently meant to trigger for
certain overflows, so I'm going to resolve this as fixed.
More information about the Gcc-bugs
mailing list