diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-11-15 04:44:13 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-11-15 04:44:13 +0000 |
commit | 973e72a8ddbf1645ce8da4d22c60babbdb9b5f79 (patch) | |
tree | 8f046f20dffd572927a231be51758cf0ab5b2ec2 | |
parent | 60595dab8bd9800f6b0b724fa4d859ada78c264f (diff) |
Add a test case for compound assignments that lazily symbolicate the value of the LHS when the computation type is an integer of more bits.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59352 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Analysis/null-deref-ps.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Analysis/null-deref-ps.c b/test/Analysis/null-deref-ps.c index 57966b332f..c9477566cb 100644 --- a/test/Analysis/null-deref-ps.c +++ b/test/Analysis/null-deref-ps.c @@ -114,3 +114,23 @@ int f9b(unsigned len) { return *p++; // no-warning } +int* f10(int* p, signed char x, int y) { + // This line tests symbolication with compound assignments where the + // LHS and RHS have different bitwidths. The new symbolic value + // for 'x' should have a bitwidth of 8. + x &= y; + + // This tests that our symbolication worked, and that we correctly test + // x against 0 (with the same bitwidth). + if (!x) { + if (!p) return; + *p = 10; + } + else p = 0; + + if (!x) + *p = 5; // no-warning + + return p; +} + |