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