[LLVMbugs] [Bug 9541] New: "The left operand to '+' is always 0" false positive
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Mar 23 23:37:04 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9541
Summary: "The left operand to '+' is always 0" false positive
Product: clang
Version: 2.9
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
AssignedTo: kremenek at apple.com
ReportedBy: drew at sealedabstract.com
CC: llvmbugs at cs.uiuc.edu
(Using XCode 4 production a.k.a. tags/Apple/clang-137 "based on LLVM 2.9svn")
The following function:
void test(NSData* theData) {
NSInteger i;
for (i=0; i < 50; i += 3) {
for (long j = i; j < (i + 3); j++) {
}
}
}
generates an analyzer result with the message "The left operand to '+' is
always 0". However, obviously i is incremented in the loop condition. The
patch
-for (i=0; i < 50; i += 3) {
+for (i=2; i < 50; i += 3) {
produces no analyzer warning, nor does an inline declaration:
-NSInteger i;
-for (i=0; i < 50; i += 3) {
+for (NSInteger i=0; i < 50; i += 3) {
--
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