PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / pr46777.c
blobe9f40a080ebad7e7702180846772c93e69ee7779
1 /* PR rtl-optimization/46777 */
2 /* { dg-do compile } */
3 /* { dg-options "-fgcse -O -fno-tree-dominator-opts -funroll-loops" } */
5 struct S { char s[256]; };
7 static inline int
8 foo (int x, int y)
10 switch (x)
12 case 1:
13 case 2:
14 return 3;
15 case 3:
16 case 4:
17 return 2;
18 case 5:
19 switch (y)
21 case 4:
22 return 1;
25 return 0;
28 void
29 bar (struct S *x, int *y, int *z, int **w)
31 switch (*y ? x->s[*y] : foo (y[1], y[0]))
33 case 3:
34 if (y + 2 == z)
35 for (;;)
37 y += 2;
38 switch (*y ? x->s[*y] : foo (y[1], y[0]))
40 case 6:
41 break;
42 default:
43 *w = y;
45 if (y == z)
46 break;