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 | 3ebd7dea7e99071bdea56981f652fdf6dbaa0802 (patch) | |
| tree | e82dab4b3389f504f18734b28baf5005fe0e6f4e | |
| parent | 4413714946bf2a9e6d170393319ffb51b0866fcc (diff) | |
| download | bcm5719-llvm-3ebd7dea7e99071bdea56981f652fdf6dbaa0802.tar.gz bcm5719-llvm-3ebd7dea7e99071bdea56981f652fdf6dbaa0802.zip | |
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.
llvm-svn: 59352
| -rw-r--r-- | clang/test/Analysis/null-deref-ps.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/Analysis/null-deref-ps.c b/clang/test/Analysis/null-deref-ps.c index 57966b332f5..c9477566cb1 100644 --- a/clang/test/Analysis/null-deref-ps.c +++ b/clang/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; +} + |

