[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / solver-sym-simplification-with-proper-range-type.c
blobc76e0acd3d52c5e46c137f4fc7419810f8c1ec4d
1 // RUN: %clang_analyze_cc1 %s \
2 // RUN: -analyzer-checker=core \
3 // RUN: -analyzer-checker=debug.ExprInspection \
4 // RUN: -verify
6 // Here we test that the range based solver equivalency tracking mechanism
7 // assigns a properly typed range to the simplified symbol.
9 void clang_analyzer_printState(void);
10 void clang_analyzer_eval(int);
12 void f(int a0, int b0, int c)
14 int a1 = a0 - b0;
15 int b1 = (unsigned)a1 + c;
16 if (c == 0) {
18 int d = 7L / b1; // ...
19 // At this point b1 is considered non-zero, which results in a new
20 // constraint for $a0 - $b0 + $c. The type of this sym is unsigned,
21 // however, the simplified sym is $a0 - $b0 and its type is signed.
22 // This is probably the result of the inherent improper handling of
23 // casts. Anyway, Range assignment for constraints use this type
24 // information. Therefore, we must make sure that first we simplify the
25 // symbol and only then we assign the range.
27 clang_analyzer_eval(a0 - b0 != 0); // expected-warning{{TRUE}}