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

            Bug ID: 15636
           Summary: clang should warn on suspicious increments of loop
                    variables
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Consider the following code snippet:

void foo(char *a, char *b, unsigned c) {
    for (unsigned i = 0; i < c; ++i) {
        a[i] = b[i];
        ++i;
    }
}

clang does not currently warn on this, even though the code is likely incorrect
(incrementing i both in the loop latch and in the body of the loop).  clang
should produce a warning when it detects a variable that is incremented in the
latch of the for header, and *unconditionally* incremented in the body of the
loop.

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