http://llvm.org/bugs/show_bug.cgi?id=10039
Summary: False positive warning indicating dead code on nested
loop variable reuse
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]
Upon reusing a variable declared outside the loop scope that has an initial
value of zero on a nested loop, the analyzer reports a warning that the
variable is always zero.
Attached is a reduced test case, this is the output I see from clang for that
file:
`
clang --analyze test.m
test.m:14:28: warning: The left operand to '+' is always 0
for (j = i; j < (i + 3); j++) {
~ ^
1 warning generated.
`
This issue was initially observed in live code on the ASI HTTP Request library:
https://github.com/pokeb/asi-http-request/blob/4d909a63a0ce6a1c3cde8526159ed7f91b6568ee/Classes/ASIHTTPRequest.m#L4528
Reported (and a fix released) here:
https://github.com/pokeb/asi-http-request/issues/165
--
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