summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/diagnostics/find_last_store.c
blob: 486e4ec64d16914e20d15b26642be97ae446edc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=text -verify %s
typedef struct { float b; } c;
void *a();
void *d() {
  return a();
}

void no_find_last_store() {
  c *e = d(); // expected-note{{'e' initialized here}}

  (void)(e || e->b); // expected-note{{Assuming 'e' is null}}
      // expected-note@-1{{Left side of '||' is false}}
      // expected-note@-2{{Access to field 'b' results in a dereference of a null pointer (loaded from variable 'e')}}
      // expected-warning@-3{{Access to field 'b' results in a dereference of a null pointer (loaded from variable 'e')}}
}
OpenPOWER on IntegriCloud