| 1 |
/* PR middle-end/88273 - bogus warning: 'memcpy' offset [-527, -529] |
| 2 |
is out of the bounds [0, 16] |
| 3 |
{ dg-do compile } |
| 4 |
{ dg-options "-O2 -Wall" } */ |
| 5 |
|
| 6 |
typedef __SIZE_TYPE__ size_t; |
| 7 |
|
| 8 |
void *q; |
| 9 |
|
| 10 |
size_t x, y; |
| 11 |
|
| 12 |
inline void f (char *p, int i, size_t j) |
| 13 |
{ |
| 14 |
size_t n = y ? y : j; |
| 15 |
|
| 16 |
p += x - i; |
| 17 |
|
| 18 |
__builtin_memcpy (q, p, n); /* { dg-bogus "bounds" } */ |
| 19 |
|
| 20 |
x = n; |
| 21 |
} |
| 22 |
|
| 23 |
void g (void) |
| 24 |
{ |
| 25 |
struct { char a[16]; } s; |
| 26 |
|
| 27 |
f (q, 0, sizeof s); |
| 28 |
|
| 29 |
f (s.a, 33 * sizeof s, 1); |
| 30 |
} |