OSDN Git Service

2013-01-24 Martin Jambor <mjambor@suse.cz>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / pr46777.c
1 /* PR rtl-optimization/46777 */
2 /* { dg-do compile } */
3 /* { dg-options "-fgcse -O -fno-tree-dominator-opts -funroll-loops" } */
4
5 struct S { char s[256]; };
6
7 static inline int
8 foo (int x, int y)
9 {
10   switch (x)
11     {
12     case 1:
13     case 2:
14       return 3;
15     case 3:
16     case 4:
17       return 2;
18     case 5:
19       switch (y)
20         {
21         case 4:
22           return 1;
23         }
24     }
25   return 0;
26 }
27
28 void
29 bar (struct S *x, int *y, int *z, int **w)
30 {
31   switch (*y ? x->s[*y] : foo (y[1], y[0]))
32     {
33     case 3:
34       if (y + 2 == z)
35         for (;;)
36           {
37             y += 2;
38             switch (*y ? x->s[*y] : foo (y[1], y[0]))
39               {
40               case 6:
41                 break;
42               default:
43                 *w = y;
44               }
45             if (y == z)
46               break;
47           }
48     }
49 }