]> granicus.if.org Git - clang/commitdiff
Add a test case for compound assignments that lazily symbolicate the value of the...
authorTed Kremenek <kremenek@apple.com>
Sat, 15 Nov 2008 04:44:13 +0000 (04:44 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 15 Nov 2008 04:44:13 +0000 (04:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59352 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/null-deref-ps.c

index 57966b332f5c93e5cf28bf45987de91cb2fc4117..c9477566cb16ee8daf2451ade6a83c36e846ab55 100644 (file)
@@ -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;
+}
+