1 /* { dg-do compile } */ 2 /* { dg-options "-Wjump-misses-init -Wno-switch-unreachable" } */ 3 int f1(int a)4f1 (int a) 5 { 6 if (a > 0) 7 { 8 int i = 7; /* { dg-message "here" } */ 9 lab: /* { dg-message "here" } */ 10 return a; 11 } 12 else 13 { 14 if (a < 0) 15 goto lab; /* { dg-warning "jump" } */ 16 return 1; 17 } 18 } 19 20 int f2(int a)21f2 (int a) 22 { 23 if (a > 0) 24 { 25 if (a < 0) 26 goto lab; /* { dg-warning "jump" } */ 27 return 1; 28 } 29 else 30 { 31 int i = 7; /* { dg-message "here" } */ 32 lab: /* { dg-message "here" } */ 33 return a; 34 } 35 } 36 37 int f3(int a)38f3 (int a) 39 { 40 if (a > 0) 41 { 42 static int i = 7; 43 lab: 44 return a; 45 } 46 else 47 { 48 if (a < 0) 49 goto lab; 50 return 1; 51 } 52 } 53 54 int f4(int a)55f4 (int a) 56 { 57 if (a > 0) 58 { 59 if (a < 0) 60 goto lab; 61 return 1; 62 } 63 else 64 { 65 static int i = 7; 66 lab: 67 return a; 68 } 69 } 70 71 int f5(int a)72f5 (int a) 73 { 74 if (a > 0) 75 { 76 int b = 1; 77 if (a < 0) 78 goto lab; 79 } 80 lab: 81 return a; 82 } 83 84 int f6(int a)85f6 (int a) 86 { 87 if (a > 0) 88 { 89 lab: 90 return a; 91 } 92 else 93 { 94 int b = 1; 95 goto lab; 96 } 97 } 98 99 int f7(int a)100f7 (int a) 101 { 102 switch (a) /* { dg-message "switch" } */ 103 { 104 int b = 1; /* { dg-message "here" } */ 105 106 case 1: /* { dg-warning "jump" } */ 107 return a; 108 } 109 } 110 111 int f8(int a)112f8 (int a) 113 { 114 switch (a) /* { dg-message "switch" } */ 115 { 116 int b = 1; /* { dg-message "here" } */ 117 118 case 1: /* { dg-warning "jump" } */ 119 goto lab; 120 } 121 lab: 122 return a; 123 } 124 125 int f9(int a)126f9 (int a) 127 { 128 switch (a) 129 { 130 case 0: 131 { 132 int b = 1; 133 return b; 134 } 135 case 1: 136 return a; 137 } 138 } 139 140 int f10(int a)141f10 (int a) 142 { 143 switch (a) 144 { 145 case 0: 146 { 147 int b = 1; 148 goto lab; 149 } 150 151 case 1: 152 goto lab; 153 } 154 lab: 155 return a; 156 } 157