• Home
  • Raw
  • Download

Lines Matching +full:sometimes +full:- +full:uninitialized

1 // RUN: %clang_cc1 -fsyntax-only -Wuninitialized -Wconditional-uninitialized -fsyntax-only -fblocks…
7 int x; // expected-note{{initialize the variable 'x' to silence this warning}} in test1()
8 return x; // expected-warning{{variable 'x' is uninitialized when used here}} in test1()
13 return x; // no-warning in test2()
19 return x; // no-warning in test3()
23 int x; // expected-note{{initialize the variable 'x' to silence this warning}} in test4()
24 ++x; // expected-warning{{variable 'x' is uninitialized when used here}} in test4()
29 int x, y; // expected-note{{initialize the variable 'y' to silence this warning}} in test5()
30 x = y; // expected-warning{{variable 'y' is uninitialized when used here}} in test5()
35 int x; // expected-note{{initialize the variable 'x' to silence this warning}} in test6()
36 x += 2; // expected-warning{{variable 'x' is uninitialized when used here}} in test6()
41 int x; // expected-note{{initialize the variable 'x' to silence this warning}} in test7()
42 …if (y) // expected-warning{{variable 'x' is used uninitialized whenever 'if' condition is false}} \ in test7()
43 // expected-note{{remove the 'if' if its condition is always true}} in test7()
45 return x; // expected-note{{uninitialized use occurs here}} in test7()
49 int x = x; // expected-note{{variable 'x' is declared here}} in test7b()
52 // Warn with "may be uninitialized" here (not "is sometimes uninitialized"), in test7b()
53 // since the self-initialization is intended to suppress a -Wuninitialized in test7b()
55 return x; // expected-warning{{variable 'x' may be uninitialized when used here}} in test7b()
68 int x; // expected-note{{initialize the variable 'x' to silence this warning}} in test9()
70 if (i == n - 1) in test9()
74 return x; // expected-warning{{variable 'x' may be uninitialized when used here}} in test9()
78 int x; // expected-note{{initialize the variable 'x' to silence this warning}} in test10()
82 return x; // expected-warning{{variable 'x' may be uninitialized when used here}} in test10()
86 int x; // expected-note{{initialize the variable 'x' to silence this warning}} in test11()
90 return x; // expected-warning{{variable 'x' may be uninitialized when used here}} in test11()
94 …for (unsigned i ; n ; ++i) ; // expected-warning{{variable 'i' is uninitialized when used here}} e… in test12()
99 return i; // no-warning in test13()
109 int x = x; // no-warning: signals intended lack of initialization. in test15()
113 // Warn here with the self-init, since it does result in a use of in test15b()
115 …int x = x; // expected-warning {{variable 'x' is uninitialized when used within its own initializa… in test15b()
124 p[i] = 'a'; // no-warning in test16()
128 // Don't warn multiple times about the same uninitialized variable in test17()
130 int *x; // expected-note{{initialize the variable 'x' to silence this warning}} in test17()
131 *x = 1; // expected-warning{{variable 'x' is uninitialized when used here}} in test17()
132 *x = 1; // no-warning in test17()
138 return z; // no-warning in test18()
149 return z; // no-warning in test19()
154 int z; // expected-note{{initialize the variable 'z' to silence this warning}} in test20()
155 … || test19_aux3(&z)) // expected-warning {{variable 'z' is used uninitialized whenever '||' condit… in test20()
156 return z; // expected-note {{uninitialized use occurs here}} in test20()
161 int z; // expected-note{{initialize the variable 'z' to silence this warning}} in test21()
162 …z) || test19_aux2()) // expected-warning {{variable 'z' is used uninitialized whenever '||' condit… in test21()
163 return z; // expected-note {{uninitialized use occurs here}} in test21()
170 return z; // no-warning in test22()
177 return z; // no-warning in test23()
181 // The basic uninitialized value analysis doesn't have enough path-sensitivity
182 // to catch initializations relying on control-dependencies spanning multiple
184 // represent such control-dependencies, but it is a niche case.
186 unsigned val; // expected-note{{initialize the variable 'val' to silence this warning}} in test24()
191 return val; // expected-warning{{variable 'val' may be uninitialized when used here}} in test24()
195 float x; // expected-note{{initialize the variable 'x' to silence this warning}} in test25()
196 return x; // expected-warning{{variable 'x' is uninitialized when used here}} in test25()
201 MyInt x; // expected-note{{initialize the variable 'x' to silence this warning}} in test26()
202 return x; // expected-warning{{variable 'x' is uninitialized when used here}} in test26()
208 return sizeof(y->x); // no-warning in test27()
212 int len; // expected-note{{initialize the variable 'len' to silence this warning}} in test28()
213 return sizeof(int[len]); // expected-warning{{variable 'len' is uninitialized when used here}} in test28()
217 int x; // expected-note{{initialize the variable 'x' to silence this warning}} in test29()
218 (void) ^{ (void) x; }; // expected-warning{{variable 'x' is uninitialized when captured by block}} in test29()
222 static int x; // no-warning in test30()
227 __block int x; // no-warning in test31()
233 (void) ^{ (void) test32_x; }; // no-warning in test32()
237 int x; // no-warning in test_33()
242 int x; // expected-note{{initialize the variable 'x' to silence this warning}} in test_34()
244 return x; // expected-warning{{variable 'x' is uninitialized when used here}} in test_34()
256 void **pc; // expected-note{{initialize the variable 'pc' to silence this warning}} in test36()
259 goto *pc; // expected-warning{{variable 'pc' is uninitialized when used here}} in test36()
272 return identifier; // no-warning in test37()
277 // Test merging of path-specific dataflow values (without asserting).
285 int y; // expected-note{{initialize the variable 'y' to silence this warning}} in test39()
286 int z = x + y; // expected-warning {{variable 'y' is uninitialized when used here}} in test39()
292 int y; // expected-note{{initialize the variable 'y' to silence this warning}} in test40()
293 return x ? 1 : y; // expected-warning {{variable 'y' is uninitialized when used here}} in test40()
297 int y; // expected-note{{initialize the variable 'y' to silence this warning}} in test41()
298 …if (x) y = 1; // expected-warning{{variable 'y' is used uninitialized whenever 'if' condition is f… in test41()
299 // expected-note{{remove the 'if' if its condition is always true}} in test41()
300 return y; // expected-note{{uninitialized use occurs here}} in test41()
305 a = 30; // no-warning in test42()
310 int x; // expected-note{{initialize the variable 'x' to silence this warning}} in test43()
312 test43_aux(x++); // expected-warning {{variable 'x' is uninitialized when used here}} in test43()
317 int y; // expected-note{{initialize the variable 'y' to silence this warning}} in test44()
319 test43_aux(x++); // no-warning in test44()
320 x += y; // expected-warning {{variable 'y' is uninitialized when used here}} in test44()
326 if (y) // no-warning in test45()
333 int i; // expected-note{{initialize the variable 'i' to silence this warning}} in test46()
334 int j = i ? : 1; // expected-warning {{variable 'i' is uninitialized when used here}} in test46()
339 return i ? : 0; // no-warning in test47()
345 return &a ? : i; // no-warning in test49()
350 char c[1 ? : 2]; // no-warning in test50()
359 return a; // no-warning in test51()
364 int x; // expected-note {{initialize the variable 'x' to silence this warning}} in test52()
365 switch (a || b) { // expected-warning {{switch condition has boolean value}} in test52()
373 return x; // expected-warning {{variable 'x' may be uninitialized when used here}} in test52()
377 int x; // expected-note {{initialize the variable 'x' to silence this warning}} in test53()
378 int y = (x); // expected-warning {{variable 'x' is uninitialized when used here}} in test53()
381 // This CFG caused the uninitialized values warning to inf-loop.
384 int new_len; // expected-note{{initialize the variable 'new_len' to silence this warning}} in PR10379_f()
392 *len += new_len; // expected-warning {{variable 'new_len' may be uninitialized when used here}} in PR10379_f()
398 double (*memory)[2][x] = malloc(sizeof(*memory)); // no-warning in test_vla_sizeof()
408 return x; // no-warning in test_block_and_dead_code()
420 (void)(flags); // no-warning in PR11069()
424 // Test uninitialized value used in loop condition.
426 int i; // expected-note {{initialize the variable 'i' to silence this warning}} in rdar9432305()
427 for (; i < 10000; ++i) // expected-warning {{variable 'i' is uninitialized when used here}} in rdar9432305()
435 UNINIT(int, a, b); // expected-warning {{variable 'a' is uninitialized when used here}} \ in test54()
436 // expected-note {{variable 'a' is declared here}} in test54()
437 int c; // expected-note {{initialize the variable 'c' to silence this warning}} in test54()
438 ASSIGN(int, c, d); // expected-warning {{variable 'c' is uninitialized when used here}} in test54()
442 struct { struct { void *p; } a; } test55 = { { &test55.a }}; // no-warning
443 struct { struct { void *p; } a; } test56 = { { &(test56.a) }}; // no-warning
449 int k; // expected-note {{initialize}} in uninit_in_loop()
450 consume(k); // expected-warning {{variable 'k' is uninitialized}} in uninit_in_loop()
460 int k; // expected-note {{initialize}} in uninit_in_loop_goto()
462 // FIXME: This should produce the 'is uninitialized' diagnostic, but we in uninit_in_loop_goto()
464 // variable's scope has been left and re-entered. in uninit_in_loop_goto()
465 consume(k); // expected-warning {{variable 'k' may be uninitialized}} in uninit_in_loop_goto()
476 int a; // expected-note {{initialize}} in returns_twice()
477 if (!a) { // expected-warning {{variable 'a' is uninitialized}} in returns_twice()
490 int sum; // expected-note {{initialize}} in compound_assign()
492 sum += arr[i]; // expected-warning {{variable 'sum' is uninitialized}} in compound_assign()
497 int x; // expected-note {{initialize}} in compound_assign_2()
498 return x += 1; // expected-warning {{variable 'x' is uninitialized}} in compound_assign_2()
502 int x; // expected-note {{initialize}} in compound_assign_3()
503 x *= 0; // expected-warning {{variable 'x' is uninitialized}} in compound_assign_3()
508 int n = ((p && (0 || 1)) && (n = *p)) ? n : -1; // ok in self_init_in_cond()
515 int x; // expected-note {{initialize the variable 'x' to silence this warning}} in test_analyzer_noreturn()
518 ++x; // no-warning in test_analyzer_noreturn()
521 ++x; // expected-warning {{variable 'x' is uninitialized when used here}} in test_analyzer_noreturn()
532 ++x; // no-warning in test_analyzer_noreturn_2()