diff options
author | Anna Zaks <ganna@apple.com> | 2011-12-09 03:34:02 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-12-09 03:34:02 +0000 |
commit | 432a4558b8161c362efc319f8a38e074e74da201 (patch) | |
tree | ee0bbf442be115414da7089366e2f09b65453adb /test/Analysis | |
parent | 42786839cff1ccbe4d883b81d01846c5d774ffc6 (diff) | |
download | clang-432a4558b8161c362efc319f8a38e074e74da201.tar.gz |
[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
Diffstat (limited to 'test/Analysis')
-rw-r--r-- | test/Analysis/taint-tester.c | 15 |
1 files changed, 15 insertions, 0 deletions
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}} +} |