| 1 |
/* PR c/78973 - warning: ‘memcpy’: specified size exceeds maximum object size |
| 2 |
|
| 3 |
Test case for what was initially thought to be a false positive but after |
| 4 |
deeper investigation turned out to be a true positive. |
| 5 |
|
| 6 |
{ dg-do compile } |
| 7 |
{ dg-options "-O2 -Wall" } */ |
| 8 |
|
| 9 |
static void f (void *p, int n) |
| 10 |
{ |
| 11 |
if (n <= 4) |
| 12 |
__builtin_memset (p, 0, n); /* { dg-warning "exceeds maximum object size" "pr79073" { xfail { int16 && { ! msp430_large } } } } */ |
| 13 |
} |
| 14 |
|
| 15 |
void g (void *d, unsigned n) |
| 16 |
{ |
| 17 |
if (n < 5) |
| 18 |
n = 5; |
| 19 |
f (d, n); |
| 20 |
} |