mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-24 22:08:57 -04:00

This patch is a band-aid. A proper solution would be too change trackNullOrUndefValue to only try to dereference the pointer when it is relevant to the problem. Differential Revision: https://reviews.llvm.org/D52435 llvm-svn: 342920
18 lines
742 B
C
18 lines
742 B
C
// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=text -verify %s
|
|
typedef struct { float b; } c;
|
|
void *a();
|
|
void *d() {
|
|
return a(); // expected-note{{Returning pointer}}
|
|
}
|
|
|
|
void no_find_last_store() {
|
|
c *e = d(); // expected-note{{Calling 'd'}}
|
|
// expected-note@-1{{Returning from 'd'}}
|
|
// expected-note@-2{{'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')}}
|
|
}
|