[cfe-commits] r59352 - /cfe/trunk/test/Analysis/null-deref-ps.c

Ted Kremenek kremenek at apple.com
Fri Nov 14 20:44:14 PST 2008


Author: kremenek
Date: Fri Nov 14 22:44:13 2008
New Revision: 59352

URL: http://llvm.org/viewvc/llvm-project?rev=59352&view=rev
Log:
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.

Modified:
    cfe/trunk/test/Analysis/null-deref-ps.c

Modified: cfe/trunk/test/Analysis/null-deref-ps.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/null-deref-ps.c?rev=59352&r1=59351&r2=59352&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/null-deref-ps.c (original)
+++ cfe/trunk/test/Analysis/null-deref-ps.c Fri Nov 14 22:44:13 2008
@@ -114,3 +114,23 @@
   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;
+}
+





More information about the cfe-commits mailing list