1 /* PR c/49859 */
2 /* { dg-do compile } */
3
4 extern void foo (int);
5 extern int j;
6
7 void
8 fn0 (int i)
9 {
10 switch (i)
11 {
12 int k;
13 case 1:
14 k = 11;
15 foo (k);
16 }
17
18 switch (i)
19 j = 10; /* { dg-warning "statement will never be executed" } */
20
21 switch (i)
22 ;
23
24 switch (i)
25 {
26 j = 12; /* { dg-warning "statement will never be executed" } */
27 default:
28 foo (j);
29 }
30
31 int o;
32 switch (i)
33 {
34 o = 333; /* { dg-warning "statement will never be executed" } */
35 case 4: break;
36 default:
37 foo (o);
38 }
39
40 switch (i)
41 switch (j) /* { dg-warning "statement will never be executed" } */
42 {
43 o = 42; /* { dg-warning "statement will never be executed" } */
44 case 8:;
45 }
46
47 switch (i)
48 {
49 int l = 3; /* { dg-warning "statement will never be executed" } */
50 o = 5;
51 j = 7;
52 ++l;
53 }
54
55 switch (i)
56 {
57 int x;
58 int l = 3; /* { dg-warning "statement will never be executed" } */
59 ++l, ++x;
60 }
61
62 switch (i)
63 if (j != 3) /* { dg-warning "statement will never be executed" } */
64 foo (j);
65
66 switch (i)
67 while (1)
68 foo (0);
69
70 switch (i)
71 while (i > 5) { }
72
73 switch (i)
74 goto X; /* { dg-warning "statement will never be executed" } */
75 X:
76
77 switch (i)
78 do
79 foo (1);
80 while (1);
81
82 switch (i)
83 for (;;)
84 foo (-1);
85
86 switch (i)
87 default:
88 j = 6;
89
90 switch (i)
91 {
92 typedef int T;
93 case 3:
94 {
95 T x = 5;
96 foo (x);
97 }
98 }
99
100 switch (i)
101 {
102 static int g;
103 default:
104 foo (g);
105 }
106
107 switch (i)
108 {
109 L:
110 j = 16;
111 default:
112 if (j < 5)
113 goto L;
114 break;
115 }
116 }