https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88273
Bug ID: 88273 Summary: warning: 'memcpy' offset [-527, -529] is out of the bounds [0, 16] of object 'vrsave' with type 'union <anonymous>' [-Warray-bounds] Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: mathieu.malaterre at gmail dot com Target Milestone: --- Created attachment 45127 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45127&action=edit creduce code There seems to be a regression in 8.2.0 from the previous release. See original post at: * https://lkml.org/lkml/2018/8/16/117 Reduced test case: $ cat bug.c typedef struct { int a[4] } b, c; d, e; inline f(void *g, int h, int p3) { unsigned *i = 0; int copy = ({ d ?: p3; }); g += *i - h; memcpy(e, g, copy); *i = copy; } j() { f(j, 0, sizeof(c)); union { b k } vrsave; f(&vrsave, 33 * sizeof(c), 1); } With: $ powerpc-linux-gnu-gcc -Warray-bounds -mcpu=powerpc -fno-delete-null-pointer-checks -O2 -c bug.c ... bug.c:9:3: warning: 'memcpy' offset [-527, -529] is out of the bounds [0, 16] of object 'vrsave' with type 'union <anonymous>' [-Warray-bounds] memcpy(e, g, copy); For reference: $ powerpc-linux-gnu-gcc --version powerpc-linux-gnu-gcc (Debian 8.2.0-9) 8.2.0