| 1 |
// PR81354 reported this test as crashing in a limited range of revisions. |
| 2 |
// { dg-do compile } |
| 3 |
|
| 4 |
struct T { double a; double b; }; |
| 5 |
|
| 6 |
void foo(T Ad[], int As[2]) |
| 7 |
{ |
| 8 |
int j; |
| 9 |
int i; |
| 10 |
int Bs[2] = {0,0}; |
| 11 |
T Bd[16]; |
| 12 |
|
| 13 |
for (j = 0; j < 4; j++) { |
| 14 |
for (i = 0; i + 1 <= j + 1; i++) { |
| 15 |
Ad[i + As[0] * j] = Bd[i + Bs[0] * j]; |
| 16 |
} |
| 17 |
|
| 18 |
i = j + 1; // <- comment out this line and it does not crash |
| 19 |
for (; i + 1 < 5; i++) { |
| 20 |
Ad[i + As[0] * j].a = 0.0; |
| 21 |
Ad[i + As[0] * j].b = 0.0; |
| 22 |
} |
| 23 |
} |
| 24 |
} |