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: [email protected]
ReportedBy: [email protected]
CC: [email protected]
(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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs