| 1 |
/* PR tree-optimization/84053] missing -Warray-bounds accessing |
| 2 |
a local array across inlined function boundaries |
| 3 |
{ dg-do compile } |
| 4 |
{ dg-options "-O2 -Wall" } */ |
| 5 |
|
| 6 |
static int deref (const int *p, int i) |
| 7 |
{ |
| 8 |
return p[i]; // { dg-warning "array subscript \\\[3, \[0-9\]+] is outside array bounds of .int\\\[2\\\]." "ilp32" { xfail ilp32 } } |
| 9 |
|
| 10 |
// There should also be an inlining context here. PR 86650 tracks |
| 11 |
// its absence. |
| 12 |
} |
| 13 |
|
| 14 |
static int deref_3_plus (const int *p, int i) |
| 15 |
{ |
| 16 |
if (i < 3) |
| 17 |
i = 3; |
| 18 |
|
| 19 |
return deref (p, i); |
| 20 |
} |
| 21 |
|
| 22 |
int deref_a (int i) |
| 23 |
{ |
| 24 |
int a[] = { 2, 3 }; |
| 25 |
|
| 26 |
return deref_3_plus (a, i); |
| 27 |
} |