1 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -analyze -analyzer-checker=core,unix.Malloc,debug.ExprInspection -DNO_CROSSCHECK -verify %s
2 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -analyze -analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-config crosscheck-with-z3=true -verify %s
5 void clang_analyzer_dump(float);
10 if ((x
& 1) && ((x
& 1) ^ 1))
12 return *z
; // expected-warning {{Dereference of null pointer (loaded from variable 'z')}}
14 return *z
; // no-warning
19 int unary(int x
, long l
)
23 if ((x
& 1) && ((x
& 1) ^ 1))
26 return *z
; // expected-warning {{Dereference of null pointer (loaded from variable 'z')}}
28 return *z
; // no-warning
35 void f(int *a
, int *b
) {
40 g(3 / c
); // no-warning
47 while (z
< k
) { // expected-warning {{The right operand of '<' is a garbage value}}
53 _Bool c
= nondet_bool();
61 void floatUnaryNegInEq(int h
, int l
) {
63 clang_analyzer_dump(-(float)h
); // expected-warning-re{{-(float) (reg_${{[0-9]+}}<int h>)}}
64 clang_analyzer_dump((float)l
); // expected-warning-re {{(float) (reg_${{[0-9]+}}<int l>)}}
65 if (-(float)h
!= (float)l
) { // should not crash
67 // expected-warning@-1{{garbage}}
71 void floatUnaryLNotInEq(int h
, int l
) {
73 clang_analyzer_dump(!(float)h
); // expected-warning{{Unknown}}
74 clang_analyzer_dump((float)l
); // expected-warning-re {{(float) (reg_${{[0-9]+}}<int l>)}}
75 if ((!(float)h
) != (float)l
) { // should not crash
77 // expected-warning@-1{{garbage}}
81 // don't crash, and also produce a core.CallAndMessage finding
90 a(f
); // expected-warning {{1st function call argument is an uninitialized value [core.CallAndMessage]}}