uninit-vals.m revision 8e8fb3be5bd78f0564444eca02b404566a5f3b5d
1// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
2// expected-no-diagnostics
3
4typedef unsigned int NSUInteger;
5
6@interface A
7- (NSUInteger)foo;
8@end
9
10NSUInteger f8(A* x){
11  const NSUInteger n = [x foo];
12  int* bogus;  
13
14  if (n > 0) {    // tests const cast transfer function logic
15    NSUInteger i;
16    
17    for (i = 0; i < n; ++i)
18      bogus = 0;
19
20    if (bogus)  // no-warning
21      return n+1;
22  }
23  
24  return n;
25}
26
27
28// PR10163 -- don't warn for default-initialized float arrays.
29// (An additional test is in uninit-vals-ps-region.m)
30void test_PR10163(float);
31void PR10163 (void) {
32  float x[2] = {0};
33  test_PR10163(x[1]); // no-warning  
34}
35