[LLVMbugs] [Bug 8015] False use of undefined value warning due to not handling "array[symbolic value]" correctly
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Sep 1 16:29:20 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=8015
Ted Kremenek <kremenek at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #5 from Ted Kremenek <kremenek at apple.com> 2010-09-01 18:29:20 CDT ---
(In reply to comment #2)
> Created an attachment (id=5423)
--> (http://llvm.org/bugs/attachment.cgi?id=5423) [details]
> Use UnknownVal for stack-based ElementRegions with non-constant indexes
>
I've gone ahead and applied this, since I think this is a good working base to
suppress the false positive. We then should improve on from there.
Patch applied here:
http://llvm.org/viewvc/llvm-project?view=rev&revision=112766
In the patch I included a test case showing how this approach *doesn't* do the
right thing:
+// 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 actually flag a bogus null dereference warning. I'm going to file a
follow-up bug to track this one, and mark this as fixed since the false
positive is gone.
--
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