[llvm-bugs] [Bug 38563] New: Warn on unsigned underflow in loop condition

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Aug 14 05:57:25 PDT 2018


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: dcoughlin at apple.com
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180814/4b49aa2f/attachment.html>


More information about the llvm-bugs mailing list