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