xref: /llvm-project/clang/test/Analysis/diagnostics/find_last_store.c (revision 0dd49a5628bbe01cecf6516017da59ae44863ab3)
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=text -verify %s
2 typedef struct { float b; } c;
3 void *a(void);
d(void)4 void *d(void) {
5   return a();
6 }
7 
no_find_last_store(void)8 void no_find_last_store(void) {
9   c *e = d(); // expected-note{{'e' initialized here}}
10 
11   (void)(e || e->b); // expected-note{{Assuming 'e' is null}}
12       // expected-note@-1{{Left side of '||' is false}}
13       // expected-note@-2{{Access to field 'b' results in a dereference of a null pointer (loaded from variable 'e')}}
14       // expected-warning@-3{{Access to field 'b' results in a dereference of a null pointer (loaded from variable 'e')}}
15 }
16