re PR tree-optimization/49161 (Fix VRP on switch stmts)
[gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr49161.c
1 /* PR tree-optimization/49161 */
2
3 extern void abort (void);
4
5 int c;
6
7 __attribute__((noinline, noclone)) void
8 bar (int x)
9 {
10 if (x != c++)
11 abort ();
12 }
13
14 __attribute__((noinline, noclone)) void
15 foo (int x)
16 {
17 switch (x)
18 {
19 case 3: goto l1;
20 case 4: goto l2;
21 case 6: goto l3;
22 default: return;
23 }
24 l1:
25 goto l4;
26 l2:
27 goto l4;
28 l3:
29 bar (-1);
30 l4:
31 bar (0);
32 if (x != 4)
33 bar (1);
34 if (x != 3)
35 bar (-1);
36 bar (2);
37 }
38
39 int
40 main ()
41 {
42 foo (3);
43 if (c != 3)
44 abort ();
45 return 0;
46 }