PR tree-optimization/79472
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / cswtch-4.c
blob962690d75e69b64a01d59930698a0c6fb4d8b50d
1 /* PR tree-optimization/79472 */
2 /* { dg-options "-O2 -fdump-tree-switchconv" } */
3 /* { dg-do compile } */
5 void
6 frobulate (unsigned int v)
8 const char *s;
10 switch (v)
12 case 0:
13 s = "foo";
14 break;
15 case 1:
16 s = "bar";
17 break;
18 case 2:
19 s = "spam";
20 break;
21 default:
22 __builtin_abort ();
23 break;
26 __builtin_printf ("%s\n", s);
29 void
30 frobulate_for_gcc (unsigned int v)
32 const char *s;
34 switch (v)
36 case 0:
37 s = "foo";
38 break;
39 case 1:
40 s = "bar";
41 break;
42 case 2:
43 s = "spam";
44 break;
45 default:
46 s = (const char *) 0;
47 break;
50 if (!s)
51 __builtin_abort ();
53 __builtin_printf ("%s\n", s);
56 /* { dg-final { scan-tree-dump-times "Switch converted" 2 "switchconv" } } */
57 /* { dg-final { scan-tree-dump-times "= CSWTCH" 2 "switchconv" } } */