From: Ted Kremenek Date: Sat, 15 Nov 2008 04:44:13 +0000 (+0000) Subject: Add a test case for compound assignments that lazily symbolicate the value of the... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=973e72a8ddbf1645ce8da4d22c60babbdb9b5f79;p=clang 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 --- 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; +} +