2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr81354.C
blobb3ba8f09371096fccf55913525fbbdc650a52a1f
1 // PR81354 reported this test as crashing in a limited range of revisions.
2 // { dg-do compile }
4 struct T { double a; double b; };
6 void foo(T Ad[], int As[2])
8   int j;
9   int i;
10   int Bs[2] = {0,0};
11   T Bd[16];
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     }
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   }