2 { dg-options "-O2 -Wall -Wextra -Warray-bounds -Wrestrict" } */
4 typedef __SIZE_TYPE__
size_t;
6 extern void* memcpy (void* restrict
, const void* restrict
, size_t);
8 extern void sink (void*, ...);
20 char dp1
[sizeof d
+ 1];
21 char d2x
[2 * sizeof d
];
22 char d2xp1
[2 * sizeof d
+ 1];
24 /* During development the following would incorrectly trigger:
25 warning: 'memcpy' forming offset [17, 25] is out of the bounds [0, 16]
26 of object ādā with type 'struct Data' [-Warray-bounds]
27 that wasn't caught by the test suite. Make sure it is. */
28 memcpy (&dp1
, d
.p
, sizeof dp1
); /* { dg-bogus "\\\[-Warray-bounds" } */
31 memcpy (&d2x
, d
.p
, sizeof d2x
); /* { dg-bogus "\\\[-Warray-bounds" } */
32 memcpy (&d2xp1
, d
.p
, sizeof d2xp1
); /* { dg-bogus "\\\[-Warray-bounds" } */
34 sink (&d
, &dp1
, &d2x
, &d2xp1
);