[LLVMbugs] [Bug 7763] New: Spurious warning about adding to zero

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 30 13:23:46 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=7763

           Summary: Spurious warning about adding to zero
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: tjw at omnigroup.com
                CC: llvmbugs at cs.uiuc.edu


On the attached test, checker-246 warns:


test.m:8:16: warning: The right operand to '+=' is always 0
        result += numbers[bg];
        ~~~~~~ ^  ~~~~~~~~~~~
1 warning generated.

If you comment out the inner for loop:


        for (int i = 0; i < 256; i++) {
            unused = i;
        }

the spurious warning about adding to zero goes away. I think I've convinced
myself that the right side will only be zero on the first iteration of the
loop, but its possible clang is being more observant.

-- 
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