Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / builtin_bitcast.cpp
blob396e7caa45f6acd5975bff6987a98aa796cc0328
1 // RUN: %clang_analyze_cc1 -triple x86_64-unknown-unknown -verify %s \
2 // RUN: -analyzer-checker=core,debug.ExprInspection
4 template <typename T> void clang_analyzer_dump(T);
6 __attribute__((always_inline)) static inline constexpr unsigned int _castf32_u32(float __A) {
7 return __builtin_bit_cast(unsigned int, __A); // no-warning
10 void test(int i) {
11 _castf32_u32(42);
13 float f = 42;
15 // Loading from a floating point value results in unknown,
16 // which later materializes as a conjured value.
17 auto g = __builtin_bit_cast(unsigned int, f);
18 clang_analyzer_dump(g);
19 // expected-warning-re@-1 {{{{^conj_\$[0-9]+{unsigned int,}}}}
21 auto g2 = __builtin_bit_cast(unsigned int, 42.0f);
22 clang_analyzer_dump(g2);
23 // expected-warning-re@-1 {{{{^conj_\$[0-9]+{unsigned int,}}}}
25 auto g3 = __builtin_bit_cast(unsigned int, i);
26 clang_analyzer_dump(g3);
27 // expected-warning-re@-1 {{{{^reg_\$[0-9]+<int i>}}}}
29 auto g4 = __builtin_bit_cast(unsigned long, &i);
30 clang_analyzer_dump(g4);
31 // expected-warning@-1 {{&i [as 64 bit integer]}}