| 1 |
/* PR c++/120954 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -Warray-bounds=2" } */ |
| 4 |
|
| 5 |
static const int a[32] = { 11, 12, 13, 14, 15 }; |
| 6 |
static const int b[32] = { 21, 22, 23, 24, 25 }; |
| 7 |
static const int c[32] = { 31, 32, 33, 34, 35 }; |
| 8 |
static const int d[32] = { 111, 112, 113, 114, 115 }; |
| 9 |
static const int e[32] = { 121, 122, 123, 124, 125 }; |
| 10 |
static const int f[32] = { 131, 132, 133, 134, 135 }; |
| 11 |
|
| 12 |
int |
| 13 |
foo (int x, int y) |
| 14 |
{ |
| 15 |
int r = 0; |
| 16 |
if (x >= 0 && x < 32) |
| 17 |
r = (y >= 4 ? (y >= 0x65 ? a : b ) : c)[x]; |
| 18 |
else if (x >= 0x100 && x < 0x120) |
| 19 |
r = (y >= 4 ? (y >= 0x65 ? d : e ) : f)[x - 0x100]; |
| 20 |
return r; |
| 21 |
} |