2014-07-29 Ed Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / gcc / testsuite / gcc.dg / Wjump-misses-init-1.c
blob86117f1f2f0d666ceac7723234615fbfad2ccecf
1 /* { dg-do compile } */
2 /* { dg-options "-Wjump-misses-init" } */
3 int
4 f1 (int a)
6 if (a > 0)
8 int i = 7; /* { dg-message "here" } */
9 lab: /* { dg-message "here" } */
10 return a;
12 else
14 if (a < 0)
15 goto lab; /* { dg-warning "jump" } */
16 return 1;
20 int
21 f2 (int a)
23 if (a > 0)
25 if (a < 0)
26 goto lab; /* { dg-warning "jump" } */
27 return 1;
29 else
31 int i = 7; /* { dg-message "here" } */
32 lab: /* { dg-message "here" } */
33 return a;
37 int
38 f3 (int a)
40 if (a > 0)
42 static int i = 7;
43 lab:
44 return a;
46 else
48 if (a < 0)
49 goto lab;
50 return 1;
54 int
55 f4 (int a)
57 if (a > 0)
59 if (a < 0)
60 goto lab;
61 return 1;
63 else
65 static int i = 7;
66 lab:
67 return a;
71 int
72 f5 (int a)
74 if (a > 0)
76 int b = 1;
77 if (a < 0)
78 goto lab;
80 lab:
81 return a;
84 int
85 f6 (int a)
87 if (a > 0)
89 lab:
90 return a;
92 else
94 int b = 1;
95 goto lab;
99 int
100 f7 (int a)
102 switch (a) /* { dg-message "switch" } */
104 int b = 1; /* { dg-message "here" } */
106 case 1: /* { dg-warning "jump" } */
107 return a;
112 f8 (int a)
114 switch (a) /* { dg-message "switch" } */
116 int b = 1; /* { dg-message "here" } */
118 case 1: /* { dg-warning "jump" } */
119 goto lab;
121 lab:
122 return a;
126 f9 (int a)
128 switch (a)
130 case 0:
132 int b = 1;
133 return b;
135 case 1:
136 return a;
141 f10 (int a)
143 switch (a)
145 case 0:
147 int b = 1;
148 goto lab;
151 case 1:
152 goto lab;
154 lab:
155 return a;