[RISCV] Add shrinkwrap test cases showing gaps in current impl
[llvm-project.git] / clang / test / Analysis / svalbuilder-float-cast.c
blob6b0c6f369f71813360d4292c73ce20d67e8f9219
1 // RUN: %clang_analyze_cc1 -analyzer-checker debug.ExprInspection -Wno-deprecated-non-prototype -verify %s
2 // RUN: %clang_analyze_cc1 -analyzer-checker debug.ExprInspection -Wno-deprecated-non-prototype -verify %s \
3 // RUN: -analyzer-config support-symbolic-integer-casts=true
5 void clang_analyzer_denote(int, const char *);
6 void clang_analyzer_express(int);
7 void clang_analyzer_dump(int);
8 void clang_analyzer_dump_ptr(int *);
10 void SymbolCast_of_float_type_aux(int *p) {
11 clang_analyzer_dump_ptr(p); // expected-warning {{&x}}
12 clang_analyzer_dump(*p); // expected-warning {{Unknown}}
13 // Storing to the memory region of 'float x' as 'int' will
14 // materialize a fresh conjured symbol to regain accuracy.
15 *p += 0;
16 clang_analyzer_dump_ptr(p); // expected-warning {{&x}}
17 clang_analyzer_dump(*p); // expected-warning {{conj_$0{int}}
18 clang_analyzer_denote(*p, "$x");
20 *p += 1;
21 // This should NOT be (float)$x + 1. Symbol $x was never casted to float.
22 clang_analyzer_express(*p); // expected-warning{{$x + 1}}
25 void SymbolCast_of_float_type(void) {
26 extern float x;
27 void (*f)() = SymbolCast_of_float_type_aux;
28 f(&x);