1 /* { dg-do run } */
2 /* { dg-options "-g" } */
3
4 void __attribute__((noinline))
5 optimize_me_not ()
6 {
7 __asm__ volatile ("" : : : "memory");
8 }
9 volatile int a;
10 static short b[3][9][1] = {5};
11 int c;
12 int main() {
13 int i, d;
14 i = 0;
15 for (; i < 3; i++) {
16 c = 0;
17 for (; c < 9; c++) {
18 d = 0;
19 for (; d < 1; d++)
20 a = b[i][c][d];
21 }
22 }
23 i = c = 0;
24 for (; c < 7; c++)
25 for (; d < 6; d++)
26 a;
27 /* i may very well be optimized out, so we cannot test for i == 0.
28 Instead test i + 1 which will make the test UNSUPPORTED if i
29 is optimized out. Since the test previously had wrong debug
30 with i == 2 this is acceptable. Optimally we'd produce a
31 debug stmt for the final value of the loop which would fix
32 the UNSUPPORTED cases. */
33 optimize_me_not(); /* { dg-final { gdb-test . "i + 1" "1" } } */
34 }