OSDN Git Service

2011-09-29 Artjoms Sinkarovs <artyom.shinkaroff@gmail.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / 20041213-2.c
1 /* PR tree-optimization/18694
2
3    The dominator optimization didn't take the PHI evaluation order
4    into account when threading an edge.  */
5
6 extern void abort (void) __attribute__((noreturn));
7 extern void exit (int) __attribute__((noreturn));
8
9 void __attribute__((noinline))
10 foo (int i)
11 {
12   int next_n = 1;
13   int j = 0;
14
15   for (; i != 0; i--)
16     {
17       int n;
18
19       for (n = next_n; j < n; j++)
20         next_n++;
21
22       if (j != n)
23         abort ();
24     }
25 }
26
27 int
28 main (void)
29 {
30   foo (2);
31   exit (0);
32 }