1 // RUN: %clang_analyze_cc1 %s \ 2 // RUN: -analyzer-checker=core \ 3 // RUN: -analyzer-checker=debug.ExprInspection \ 4 // RUN: -verify 5 6 // Here we test that the range based solver equivalency tracking mechanism 7 // assigns a properly typed range to the simplified symbol. 8 9 void clang_analyzer_printState(); 10 void clang_analyzer_eval(int); 11 12 void f(int a0, int b0, int c) 13 { 14 int a1 = a0 - b0; 15 int b1 = (unsigned)a1 + c; 16 if (c == 0) { 17 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. 26 27 clang_analyzer_eval(a0 - b0 != 0); // expected-warning{{TRUE}} 28 } 29 } 30