Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -warn-dead-stores -fblocks -verify %s |
| 2 | // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=basic -warn-dead-stores -fblocks -verify %s |
| 3 | // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -analyzer-constraints=range -warn-dead-stores -fblocks -verify %s |
| 4 | // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -warn-dead-stores -fblocks -verify %s |
| 5 | // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -warn-dead-stores -fblocks -verify %s |
Ted Kremenek | 8aefcbf | 2007-11-19 06:38:23 +0000 | [diff] [blame] | 6 | |
Ted Kremenek | 49a2fd2 | 2008-04-14 15:56:17 +0000 | [diff] [blame] | 7 | void f1() { |
Ted Kremenek | aa395ba | 2007-11-18 20:06:35 +0000 | [diff] [blame] | 8 | int k, y; |
Ted Kremenek | 0fdf06e | 2008-03-19 07:31:52 +0000 | [diff] [blame] | 9 | int abc=1; |
Ted Kremenek | 1a654b6 | 2008-06-20 21:45:25 +0000 | [diff] [blame] | 10 | long idx=abc+3*5; // expected-warning {{never read}} |
Ted Kremenek | aa395ba | 2007-11-18 20:06:35 +0000 | [diff] [blame] | 11 | } |
Ted Kremenek | 8aefcbf | 2007-11-19 06:38:23 +0000 | [diff] [blame] | 12 | |
Ted Kremenek | 49a2fd2 | 2008-04-14 15:56:17 +0000 | [diff] [blame] | 13 | void f2(void *b) { |
Ted Kremenek | 8aefcbf | 2007-11-19 06:38:23 +0000 | [diff] [blame] | 14 | char *c = (char*)b; // no-warning |
Ted Kremenek | 1a654b6 | 2008-06-20 21:45:25 +0000 | [diff] [blame] | 15 | char *d = b+1; // expected-warning {{never read}} |
Douglas Gregor | a316e7b | 2009-02-14 00:32:47 +0000 | [diff] [blame] | 16 | printf("%s", c); // expected-warning{{implicitly declaring C library function 'printf' with type 'int (char const *, ...)'}} \ |
| 17 | // expected-note{{please include the header <stdio.h> or explicitly provide a declaration for 'printf'}} |
Ted Kremenek | 8aefcbf | 2007-11-19 06:38:23 +0000 | [diff] [blame] | 18 | } |
Ted Kremenek | 74c43a0 | 2007-11-20 03:03:00 +0000 | [diff] [blame] | 19 | |
Ted Kremenek | 49a2fd2 | 2008-04-14 15:56:17 +0000 | [diff] [blame] | 20 | void f3() { |
Ted Kremenek | 0fdf06e | 2008-03-19 07:31:52 +0000 | [diff] [blame] | 21 | int r; |
| 22 | if ((r = f()) != 0) { // no-warning |
| 23 | int y = r; // no-warning |
| 24 | printf("the error is: %d\n", y); |
| 25 | } |
Ted Kremenek | 74c43a0 | 2007-11-20 03:03:00 +0000 | [diff] [blame] | 26 | } |
Ted Kremenek | 49a2fd2 | 2008-04-14 15:56:17 +0000 | [diff] [blame] | 27 | |
| 28 | void f4(int k) { |
| 29 | |
| 30 | k = 1; |
| 31 | |
| 32 | if (k) |
| 33 | f1(); |
| 34 | |
Ted Kremenek | 1a654b6 | 2008-06-20 21:45:25 +0000 | [diff] [blame] | 35 | k = 2; // expected-warning {{never read}} |
Ted Kremenek | 49a2fd2 | 2008-04-14 15:56:17 +0000 | [diff] [blame] | 36 | } |
Ted Kremenek | 93fab7c | 2009-11-22 20:26:21 +0000 | [diff] [blame] | 37 | |
Ted Kremenek | f87821c | 2008-04-15 18:37:29 +0000 | [diff] [blame] | 38 | void f5() { |
| 39 | |
| 40 | int x = 4; // no-warning |
Ted Kremenek | 1a654b6 | 2008-06-20 21:45:25 +0000 | [diff] [blame] | 41 | int *p = &x; // expected-warning{{never read}} |
Ted Kremenek | f87821c | 2008-04-15 18:37:29 +0000 | [diff] [blame] | 42 | |
Ted Kremenek | a23157e | 2008-05-05 23:12:21 +0000 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | int f6() { |
| 46 | |
| 47 | int x = 4; |
Ted Kremenek | 1a654b6 | 2008-06-20 21:45:25 +0000 | [diff] [blame] | 48 | ++x; // expected-warning{{never read}} |
Ted Kremenek | a23157e | 2008-05-05 23:12:21 +0000 | [diff] [blame] | 49 | return 1; |
| 50 | } |
Ted Kremenek | 1a654b6 | 2008-06-20 21:45:25 +0000 | [diff] [blame] | 51 | |
| 52 | int f7(int *p) { |
| 53 | // This is allowed for defensive programming. |
| 54 | p = 0; // no-warning |
| 55 | return 1; |
| 56 | } |
| 57 | |
Ted Kremenek | 93fab7c | 2009-11-22 20:26:21 +0000 | [diff] [blame] | 58 | int f7b(int *p) { |
| 59 | // This is allowed for defensive programming. |
| 60 | p = (0); // no-warning |
| 61 | return 1; |
| 62 | } |
| 63 | |
| 64 | int f7c(int *p) { |
| 65 | // This is allowed for defensive programming. |
| 66 | p = (void*) 0; // no-warning |
| 67 | return 1; |
| 68 | } |
| 69 | |
| 70 | int f7d(int *p) { |
| 71 | // This is allowed for defensive programming. |
| 72 | p = (void*) (0); // no-warning |
| 73 | return 1; |
| 74 | } |
| 75 | |
Ted Kremenek | 1a654b6 | 2008-06-20 21:45:25 +0000 | [diff] [blame] | 76 | int f8(int *p) { |
Daniel Dunbar | 4489fe1 | 2008-08-05 00:07:51 +0000 | [diff] [blame] | 77 | extern int *baz(); |
John McCall | f66d5cd | 2009-10-13 17:57:23 +0000 | [diff] [blame] | 78 | if ((p = baz())) // expected-warning{{Although the value}} |
Ted Kremenek | 1a654b6 | 2008-06-20 21:45:25 +0000 | [diff] [blame] | 79 | return 1; |
| 80 | return 0; |
| 81 | } |
| 82 | |
Ted Kremenek | 2cfac22 | 2008-07-23 21:16:38 +0000 | [diff] [blame] | 83 | int f9() { |
| 84 | int x = 4; |
| 85 | x = x + 10; // expected-warning{{never read}} |
| 86 | return 1; |
| 87 | } |
| 88 | |
Ted Kremenek | 2cfac22 | 2008-07-23 21:16:38 +0000 | [diff] [blame] | 89 | int f10() { |
| 90 | int x = 4; |
| 91 | x = 10 + x; // expected-warning{{never read}} |
| 92 | return 1; |
| 93 | } |
| 94 | |
Ted Kremenek | 8b00b6e | 2008-07-23 23:18:43 +0000 | [diff] [blame] | 95 | int f11() { |
| 96 | int x = 4; |
Ted Kremenek | 380277e | 2008-10-15 05:23:41 +0000 | [diff] [blame] | 97 | return x++; // expected-warning{{never read}} |
Ted Kremenek | 8b00b6e | 2008-07-23 23:18:43 +0000 | [diff] [blame] | 98 | } |
| 99 | |
Ted Kremenek | 380277e | 2008-10-15 05:23:41 +0000 | [diff] [blame] | 100 | int f11b() { |
| 101 | int x = 4; |
Ted Kremenek | 7f5fce7 | 2009-01-20 00:47:45 +0000 | [diff] [blame] | 102 | return ((((++x)))); // no-warning |
Ted Kremenek | 380277e | 2008-10-15 05:23:41 +0000 | [diff] [blame] | 103 | } |
| 104 | |
Ted Kremenek | fc7ff55 | 2008-07-25 04:47:34 +0000 | [diff] [blame] | 105 | int f12a(int y) { |
| 106 | int x = y; // expected-warning{{never read}} |
| 107 | return 1; |
| 108 | } |
| 109 | int f12b(int y) { |
| 110 | int x __attribute__((unused)) = y; // no-warning |
| 111 | return 1; |
| 112 | } |
Ted Kremenek | 2cfac22 | 2008-07-23 21:16:38 +0000 | [diff] [blame] | 113 | |
Ted Kremenek | efe88f5 | 2008-08-06 23:26:31 +0000 | [diff] [blame] | 114 | // Filed with PR 2630. This code should produce no warnings. |
| 115 | int f13(void) |
| 116 | { |
| 117 | int a = 1; |
| 118 | int b, c = b = a + a; |
| 119 | |
| 120 | if (b > 0) |
| 121 | return (0); |
| 122 | |
| 123 | return (a + b + c); |
| 124 | } |
| 125 | |
Ted Kremenek | b497ebd | 2008-09-04 21:52:52 +0000 | [diff] [blame] | 126 | // Filed with PR 2763. |
Ted Kremenek | 84fa6b9 | 2008-09-26 05:52:45 +0000 | [diff] [blame] | 127 | int f14(int count) { |
Ted Kremenek | b497ebd | 2008-09-04 21:52:52 +0000 | [diff] [blame] | 128 | int index, nextLineIndex; |
| 129 | for (index = 0; index < count; index = nextLineIndex+1) { |
| 130 | nextLineIndex = index+1; // no-warning |
| 131 | continue; |
| 132 | } |
| 133 | return index; |
| 134 | } |
Ted Kremenek | 84fa6b9 | 2008-09-26 05:52:45 +0000 | [diff] [blame] | 135 | |
| 136 | // Test case for <rdar://problem/6248086> |
| 137 | void f15(unsigned x, unsigned y) { |
| 138 | int count = x * y; // no-warning |
| 139 | int z[count]; |
| 140 | } |
| 141 | |
Ted Kremenek | 610a09e | 2008-09-26 22:58:57 +0000 | [diff] [blame] | 142 | int f16(int x) { |
| 143 | x = x * 2; |
Ted Kremenek | d2025e2 | 2008-09-26 23:05:47 +0000 | [diff] [blame] | 144 | x = sizeof(int [x = (x || x + 1) * 2]) // expected-warning{{Although the value stored to 'x' is used}} |
| 145 | ? 5 : 8; |
Ted Kremenek | 610a09e | 2008-09-26 22:58:57 +0000 | [diff] [blame] | 146 | return x; |
| 147 | } |
| 148 | |
Ted Kremenek | 3b58786 | 2009-01-09 22:15:01 +0000 | [diff] [blame] | 149 | // Self-assignments should not be flagged as dead stores. |
Mike Stump | a5495ea | 2009-07-21 19:01:31 +0000 | [diff] [blame] | 150 | void f17() { |
Ted Kremenek | 3b58786 | 2009-01-09 22:15:01 +0000 | [diff] [blame] | 151 | int x = 1; |
| 152 | x = x; // no-warning |
| 153 | } |
Ted Kremenek | 7f5fce7 | 2009-01-20 00:47:45 +0000 | [diff] [blame] | 154 | |
| 155 | // <rdar://problem/6506065> |
| 156 | // The values of dead stores are only "consumed" in an enclosing expression |
Mike Stump | cd7bf23 | 2009-07-17 01:04:31 +0000 | [diff] [blame] | 157 | // what that value is actually used. In other words, don't say "Although the |
| 158 | // value stored to 'x' is used...". |
Ted Kremenek | 7f5fce7 | 2009-01-20 00:47:45 +0000 | [diff] [blame] | 159 | int f18() { |
| 160 | int x = 0; // no-warning |
| 161 | if (1) |
| 162 | x = 10; // expected-warning{{Value stored to 'x' is never read}} |
| 163 | while (1) |
| 164 | x = 10; // expected-warning{{Value stored to 'x' is never read}} |
| 165 | do |
| 166 | x = 10; // expected-warning{{Value stored to 'x' is never read}} |
| 167 | while (1); |
| 168 | |
| 169 | return (x = 10); // expected-warning{{Although the value stored to 'x' is used in the enclosing expression, the value is never actually read from 'x'}} |
| 170 | } |
Ted Kremenek | d3098ee | 2009-02-09 18:01:00 +0000 | [diff] [blame] | 171 | |
| 172 | // PR 3514: false positive `dead initialization` warning for init to global |
| 173 | // http://llvm.org/bugs/show_bug.cgi?id=3514 |
| 174 | extern const int MyConstant; |
| 175 | int f19(void) { |
| 176 | int x = MyConstant; // no-warning |
| 177 | x = 1; |
| 178 | return x; |
| 179 | } |
| 180 | |
Ted Kremenek | 28433ff | 2009-03-31 03:34:38 +0000 | [diff] [blame] | 181 | int f19b(void) { // This case is the same as f19. |
Ted Kremenek | d3098ee | 2009-02-09 18:01:00 +0000 | [diff] [blame] | 182 | const int MyConstant = 0; |
Ted Kremenek | 28433ff | 2009-03-31 03:34:38 +0000 | [diff] [blame] | 183 | int x = MyConstant; // no-warning |
Ted Kremenek | d3098ee | 2009-02-09 18:01:00 +0000 | [diff] [blame] | 184 | x = 1; |
| 185 | return x; |
| 186 | } |
Ted Kremenek | 632d1ec | 2009-03-23 22:30:58 +0000 | [diff] [blame] | 187 | |
| 188 | void f20(void) { |
| 189 | int x = 1; // no-warning |
| 190 | #pragma unused(x) |
| 191 | } |
| 192 | |
Mike Stump | cd7bf23 | 2009-07-17 01:04:31 +0000 | [diff] [blame] | 193 | void halt() __attribute__((noreturn)); |
| 194 | int f21() { |
| 195 | int x = 4; |
| 196 | |
| 197 | ++x; // expected-warning{{never read}} |
| 198 | if (1) { |
| 199 | halt(); |
| 200 | (void)x; |
| 201 | } |
| 202 | return 1; |
| 203 | } |
Mike Stump | e5af3ce | 2009-07-20 23:24:15 +0000 | [diff] [blame] | 204 | |
| 205 | int j; |
| 206 | void f22() { |
| 207 | int x = 4; |
| 208 | int y1 = 4; |
| 209 | int y2 = 4; |
| 210 | int y3 = 4; |
| 211 | int y4 = 4; |
| 212 | int y5 = 4; |
| 213 | int y6 = 4; |
| 214 | int y7 = 4; |
| 215 | int y8 = 4; |
| 216 | int y9 = 4; |
| 217 | int y10 = 4; |
Mike Stump | 5f20363 | 2009-07-21 00:38:52 +0000 | [diff] [blame] | 218 | int y11 = 4; |
| 219 | int y12 = 4; |
Mike Stump | fefb9f7 | 2009-07-21 01:12:51 +0000 | [diff] [blame] | 220 | int y13 = 4; |
| 221 | int y14 = 4; |
| 222 | int y15 = 4; |
Mike Stump | 8f9893a | 2009-07-21 01:27:50 +0000 | [diff] [blame] | 223 | int y16 = 4; |
| 224 | int y17 = 4; |
| 225 | int y18 = 4; |
Mike Stump | 22cd658 | 2009-07-21 01:46:17 +0000 | [diff] [blame] | 226 | int y19 = 4; |
| 227 | int y20 = 4; |
Mike Stump | e5af3ce | 2009-07-20 23:24:15 +0000 | [diff] [blame] | 228 | |
| 229 | ++x; // expected-warning{{never read}} |
| 230 | ++y1; |
| 231 | ++y2; |
| 232 | ++y3; |
| 233 | ++y4; |
| 234 | ++y5; |
| 235 | ++y6; |
| 236 | ++y7; |
| 237 | ++y8; |
| 238 | ++y9; |
| 239 | ++y10; |
Mike Stump | 5f20363 | 2009-07-21 00:38:52 +0000 | [diff] [blame] | 240 | ++y11; |
| 241 | ++y12; |
Mike Stump | fefb9f7 | 2009-07-21 01:12:51 +0000 | [diff] [blame] | 242 | ++y13; |
| 243 | ++y14; |
| 244 | ++y15; |
Mike Stump | 8f9893a | 2009-07-21 01:27:50 +0000 | [diff] [blame] | 245 | ++y16; |
| 246 | ++y17; |
| 247 | ++y18; |
Mike Stump | 22cd658 | 2009-07-21 01:46:17 +0000 | [diff] [blame] | 248 | ++y19; |
| 249 | ++y20; |
Mike Stump | e5af3ce | 2009-07-20 23:24:15 +0000 | [diff] [blame] | 250 | |
| 251 | switch (j) { |
| 252 | case 1: |
| 253 | if (0) |
| 254 | (void)x; |
| 255 | if (1) { |
| 256 | (void)y1; |
| 257 | return; |
| 258 | } |
| 259 | (void)x; |
| 260 | break; |
| 261 | case 2: |
| 262 | if (0) |
| 263 | (void)x; |
| 264 | else { |
| 265 | (void)y2; |
| 266 | return; |
| 267 | } |
| 268 | (void)x; |
| 269 | break; |
| 270 | case 3: |
| 271 | if (1) { |
| 272 | (void)y3; |
| 273 | return; |
| 274 | } else |
| 275 | (void)x; |
| 276 | (void)x; |
| 277 | break; |
| 278 | case 4: |
| 279 | 0 ? : ((void)y4, ({ return; })); |
| 280 | (void)x; |
| 281 | break; |
| 282 | case 5: |
| 283 | 1 ? : (void)x; |
| 284 | 0 ? (void)x : ((void)y5, ({ return; })); |
| 285 | (void)x; |
| 286 | break; |
| 287 | case 6: |
| 288 | 1 ? ((void)y6, ({ return; })) : (void)x; |
| 289 | (void)x; |
| 290 | break; |
| 291 | case 7: |
| 292 | (void)(0 && x); |
| 293 | (void)y7; |
| 294 | (void)(0 || (y8, ({ return; }), 1)); |
| 295 | (void)x; |
| 296 | break; |
| 297 | case 8: |
| 298 | (void)(1 && (y9, ({ return; }), 1)); |
| 299 | (void)x; |
| 300 | break; |
| 301 | case 9: |
| 302 | (void)(1 || x); |
| 303 | (void)y10; |
Mike Stump | 5f20363 | 2009-07-21 00:38:52 +0000 | [diff] [blame] | 304 | break; |
| 305 | case 10: |
Mike Stump | 5f20363 | 2009-07-21 00:38:52 +0000 | [diff] [blame] | 306 | while (0) { |
| 307 | (void)x; |
| 308 | } |
Mike Stump | 8f9893a | 2009-07-21 01:27:50 +0000 | [diff] [blame] | 309 | (void)y11; |
Mike Stump | 5f20363 | 2009-07-21 00:38:52 +0000 | [diff] [blame] | 310 | break; |
Mike Stump | 8f9893a | 2009-07-21 01:27:50 +0000 | [diff] [blame] | 311 | case 11: |
| 312 | while (1) { |
| 313 | (void)y12; |
Mike Stump | fefb9f7 | 2009-07-21 01:12:51 +0000 | [diff] [blame] | 314 | } |
| 315 | (void)x; |
| 316 | break; |
Mike Stump | 8f9893a | 2009-07-21 01:27:50 +0000 | [diff] [blame] | 317 | case 12: |
| 318 | do { |
| 319 | (void)y13; |
| 320 | } while (0); |
| 321 | (void)y14; |
| 322 | break; |
| 323 | case 13: |
| 324 | do { |
| 325 | (void)y15; |
| 326 | } while (1); |
| 327 | (void)x; |
| 328 | break; |
Mike Stump | fefb9f7 | 2009-07-21 01:12:51 +0000 | [diff] [blame] | 329 | case 14: |
Mike Stump | 8f9893a | 2009-07-21 01:27:50 +0000 | [diff] [blame] | 330 | for (;;) { |
| 331 | (void)y16; |
| 332 | } |
| 333 | (void)x; |
| 334 | break; |
| 335 | case 15: |
| 336 | for (;1;) { |
| 337 | (void)y17; |
| 338 | } |
| 339 | (void)x; |
| 340 | break; |
| 341 | case 16: |
Mike Stump | fefb9f7 | 2009-07-21 01:12:51 +0000 | [diff] [blame] | 342 | for (;0;) { |
| 343 | (void)x; |
| 344 | } |
Mike Stump | 8f9893a | 2009-07-21 01:27:50 +0000 | [diff] [blame] | 345 | (void)y18; |
Mike Stump | fefb9f7 | 2009-07-21 01:12:51 +0000 | [diff] [blame] | 346 | break; |
Mike Stump | 22cd658 | 2009-07-21 01:46:17 +0000 | [diff] [blame] | 347 | case 17: |
| 348 | __builtin_choose_expr(0, (void)x, ((void)y19, ({ return; }))); |
| 349 | (void)x; |
| 350 | break; |
| 351 | case 19: |
| 352 | __builtin_choose_expr(1, ((void)y20, ({ return; })), (void)x); |
| 353 | (void)x; |
| 354 | break; |
Mike Stump | e5af3ce | 2009-07-20 23:24:15 +0000 | [diff] [blame] | 355 | } |
| 356 | } |
Ted Kremenek | 3a97634 | 2009-11-26 06:55:36 +0000 | [diff] [blame] | 357 | |
| 358 | void f23_aux(const char* s); |
| 359 | void f23(int argc, char **argv) { |
| 360 | int shouldLog = (argc > 1); // no-warning |
| 361 | ^{ |
| 362 | if (shouldLog) f23_aux("I did too use it!\n"); |
| 363 | else f23_aux("I shouldn't log. Wait.. d'oh!\n"); |
| 364 | }(); |
| 365 | } |
| 366 | |
| 367 | void f23_pos(int argc, char **argv) { |
| 368 | int shouldLog = (argc > 1); // expected-warning{{Value stored to 'shouldLog' during its initialization is never read}} |
| 369 | ^{ |
| 370 | f23_aux("I did too use it!\n"); |
| 371 | }(); |
| 372 | } |
Ted Kremenek | 9a0459c | 2009-12-01 23:04:14 +0000 | [diff] [blame] | 373 | |
| 374 | void f24_A(int y) { |
| 375 | // FIXME: One day this should be reported as dead since 'z = x + y' is dead. |
| 376 | int x = (y > 2); // no-warning |
| 377 | ^ { |
| 378 | int z = x + y; // FIXME: Eventually this should be reported as a dead store. |
| 379 | }(); |
| 380 | } |
| 381 | |
| 382 | void f24_B(int y) { |
| 383 | // FIXME: One day this should be reported as dead since 'x' is just overwritten. |
| 384 | __block int x = (y > 2); // no-warning |
| 385 | ^{ |
| 386 | // FIXME: This should eventually be a dead store since it is never read either. |
| 387 | x = 5; // no-warning |
| 388 | }(); |
| 389 | } |
| 390 | |
| 391 | int f24_C(int y) { |
| 392 | // FIXME: One day this should be reported as dead since 'x' is just overwritten. |
| 393 | __block int x = (y > 2); // no-warning |
| 394 | ^{ |
| 395 | x = 5; // no-warning |
| 396 | }(); |
| 397 | return x; |
| 398 | } |
| 399 | |
| 400 | int f24_D(int y) { |
| 401 | __block int x = (y > 2); // no-warning |
| 402 | ^{ |
| 403 | if (y > 4) |
| 404 | x = 5; // no-warning |
| 405 | }(); |
| 406 | return x; |
| 407 | } |
| 408 | |
Ted Kremenek | 74635d8 | 2009-12-03 00:46:16 +0000 | [diff] [blame] | 409 | // This example shows that writing to a variable captured by a block means that it might |
| 410 | // not be dead. |
| 411 | int f25(int y) { |
| 412 | __block int x = (y > 2); |
| 413 | __block int z = 0; |
| 414 | void (^foo)() = ^{ z = x + y; }; |
| 415 | x = 4; // no-warning |
| 416 | foo(); |
| 417 | return z; |
| 418 | } |
| 419 | |
| 420 | // This test is mostly the same as 'f25', but shows that the heuristic of pruning out dead |
| 421 | // stores for variables that are just marked '__block' is overly conservative. |
| 422 | int f25_b(int y) { |
| 423 | // FIXME: we should eventually report a dead store here. |
| 424 | __block int x = (y > 2); |
| 425 | __block int z = 0; |
| 426 | x = 4; // no-warning |
| 427 | return z; |
| 428 | } |
| 429 | |