Author: kremenek
Date: Wed Sep  1 18:37:38 2010
New Revision: 112770

URL: http://llvm.org/viewvc/llvm-project?rev=112770&view=rev
Log:
Add yet another test case for PR 8015, showing how reasoning over symbolic 
indices should exactly resolve over multiple index possibilities (and thus 
suppress the false positive in the test).

Modified:
    cfe/trunk/test/Analysis/misc-ps-region-store.m

Modified: cfe/trunk/test/Analysis/misc-ps-region-store.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store.m?rev=112770&r1=112769&r2=112770&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store.m (original)
+++ cfe/trunk/test/Analysis/misc-ps-region-store.m Wed Sep  1 18:37:38 2010
@@ -1125,3 +1125,18 @@
   }
 }
 
+void pr8015_F_FIXME() {
+  // Similar to pr8015_E, but like pr8015_D we check if the pointer
+  // is the same as one of the string literals.  The null dereference
+  // here is not feasible in practice, so this is a false positive.
+  int number = pr8015_A();
+  const char *numbers[] = { "zero", "one", "two" };
+  if (number < 3) {
+    const char *p = numbers[number];
+    if (p == numbers[0] || p == numbers[1] || p == numbers[2])
+      return;
+    int *q = 0;
+    *q = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}}
+  }
+}
+


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to