https://bugs.llvm.org/show_bug.cgi?id=38563

            Bug ID: 38563
           Summary: Warn on unsigned underflow in loop condition
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcough...@apple.com
          Reporter: david.bolvan...@gmail.com
                CC: llvm-bugs@lists.llvm.org

It would be useful if Clang could warn in the following case:

unsigned getSize();

int f() {
    unsigned h = 0;
    for (unsigned i = 0; i < getSize() - 1; i++) 
        // underflow if getSize returns 0
    {
        h += i;
    }
    return h;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to