gcc/testsuite/gcc.dg/loop-2.c
raw| 1 | /* PR optimization/10171 */ |
| 2 | /* Bug: unroll_loop misoptimized the function so that we got |
| 3 | 0 iterations of the loop rather than the correct 1. */ |
| 4 | /* { dg-do run } */ |
| 5 | |
| 6 | extern void abort (void); |
| 7 | extern void exit (int); |
| 8 | |
| 9 | __inline__ int tag() { return 0; } |
| 10 | |
| 11 | void f (); |
| 12 | |
| 13 | int main() { |
| 14 | int i; |
| 15 | for (i = 0; i < (tag() ? 2 : 1); i++) |
| 16 | f(); |
| 17 | abort (); |
| 18 | } |
| 19 | |
| 20 | void f () |
| 21 | { |
| 22 | exit (0); |
| 23 | } |