1 // RUN: %clang_analyze_cc1 -analyzer-checker=core \
2 // RUN:   -analyzer-checker=debug.ExprInspection \
3 // RUN:   -verify %s
4 
5 void clang_analyzer_dump(int);
6 
test_0_multiplier1(int x,int y)7 void test_0_multiplier1(int x, int y) {
8   int a = x < 0; // Eagerly bifurcate.
9   clang_analyzer_dump(a);
10   // expected-warning@-1{{0 S32b}}
11   // expected-warning@-2{{1 S32b}}
12 
13   int b = a * y;
14   clang_analyzer_dump(b);
15   // expected-warning@-1{{0 S32b}}
16   // expected-warning-re@-2{{reg_${{[[:digit:]]+}}<int y>}}
17 }
18 
test_0_multiplier2(int x,int y)19 void test_0_multiplier2(int x, int y) {
20   int a = x < 0; // Eagerly bifurcate.
21   clang_analyzer_dump(a);
22   // expected-warning@-1{{0 S32b}}
23   // expected-warning@-2{{1 S32b}}
24 
25   int b = y * a;
26   clang_analyzer_dump(b);
27   // expected-warning@-1{{0 S32b}}
28   // expected-warning-re@-2{{reg_${{[[:digit:]]+}}<int y>}}
29 }
30 
test_0_modulo(int x,int y)31 void test_0_modulo(int x, int y) {
32   int a = x < 0; // Eagerly bifurcate.
33   clang_analyzer_dump(a);
34   // expected-warning@-1{{0 S32b}}
35   // expected-warning@-2{{1 S32b}}
36 
37   int b = a % y;
38   clang_analyzer_dump(b);
39   // expected-warning@-1{{0 S32b}}
40   // expected-warning-re@-2{{1 % (reg_${{[[:digit:]]+}}<int y>)}}
41 }
42 
test_0_divisible(int x,int y)43 void test_0_divisible(int x, int y) {
44   int a = x < 0; // Eagerly bifurcate.
45   clang_analyzer_dump(a);
46   // expected-warning@-1{{0 S32b}}
47   // expected-warning@-2{{1 S32b}}
48 
49   int b = a / y;
50   clang_analyzer_dump(b);
51   // expected-warning@-1{{0 S32b}}
52   // expected-warning-re@-2{{1 / (reg_${{[[:digit:]]+}}<int y>)}}
53 }
54