From 432a4558b8161c362efc319f8a38e074e74da201 Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Fri, 9 Dec 2011 03:34:02 +0000 Subject: [analyzer] Fix inconsistency on when SValBuilder assumes that 2 types are equivalent. + A taint test which tests bitwise operations and which was triggering an assertion due to presence of the integer to integer cast. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146240 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Analysis/taint-tester.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/Analysis') diff --git a/test/Analysis/taint-tester.c b/test/Analysis/taint-tester.c index f1dd5d0f03..8a82cd397a 100644 --- a/test/Analysis/taint-tester.c +++ b/test/Analysis/taint-tester.c @@ -55,3 +55,18 @@ void taintTracking(int x) { int ty = xy.y; // FIXME: This should be tainted as well. char ntz = xy.z;// no warning } + +void BitwiseOp(int in, char inn) { + // Taint on bitwise operations, integer to integer cast. + int m; + int x = 0; + scanf("%d", &x); + int y = (in << (x << in)) * 5;// expected-warning 4 {{tainted}} + // The next line tests integer to integer cast. + int z = y & inn; // expected-warning 2 {{tainted}} + if (y == 5) // expected-warning 2 {{tainted}} + m = z | z;// expected-warning 4 {{tainted}} + else + m = inn; + int mm = m; // expected-warning {{tainted}} +} -- cgit v1.2.1