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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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

Reply via email to