https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92815
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |56456
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
With -Warray-bounds GCC issues:
t.c:7:3: warning: ‘__builtin_memcpy’ offset [4, 7] is out of the bounds [0, 4]
of object ‘s’ with type ‘struct S’ [-Warray-bounds]
7 | __builtin_strcpy (s.ax, "123");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
t.c:3:17: note: ‘s’ declared here
3 | extern struct S s /* = { 5, { 1, 2, 3, 4, 5 } } */;
| ^
The -Warray-bounds warning was in turn introduced in r255755 (in GCC 8.0):
r255755 | msebor | 2017-12-16 18:58:34 -0500 (Sat, 16 Dec 2017) | 81 lines
PR tree-optimization/78918 - missing -Wrestrict on memcpy copying over self
gcc/c-family/ChangeLog:
PR tree-optimization/78918
* c-common.c (check_function_restrict): Avoid checking built-ins.
* c.opt (-Wrestrict): Include in -Wall.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
[Bug 56456] [meta-bug] bogus/missing -Warray-bounds