[LLVMbugs] [Bug 8057] New: (follow-up PR 8015): false null dereference because of inaccurate reasoning of perfectly constrained array indices

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 1 16:31:04 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8057

           Summary: (follow-up PR 8015): false null dereference because of
                    inaccurate reasoning of perfectly constrained array
                    indices
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: kremenek at apple.com
                CC: llvmbugs at cs.uiuc.edu


>From PR 8015:

+// FIXME: This is a false positive due to not reasoning about symbolic
+// array indices correctly.  Discussion in PR 8015.
+void pr8015_D_FIXME() {
+  int number = pr8015_A();
+  const char *numbers[] = { "zero" };
+  if (number == 0) {
+    if (numbers[number] == numbers[0])
+      return;
+    int *p = 0;
+    *p = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}}
+  }
+}
+

Here we flag a bogus null dereference because 'numbers[number]' resolves to
UnknownVal, and not the region for "zero".

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list