[LLVMbugs] [Bug 10039] New: False positive warning indicating dead code on nested loop variable reuse

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 27 12:23:16 PDT 2011


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: kremenek at apple.com
        ReportedBy: paul at eipper.com.br
                CC: llvmbugs at cs.uiuc.edu


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.



More information about the llvm-bugs mailing list