[LLVMbugs] [Bug 11683] New: Detecting infinite loops

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jan 1 04:34:08 PST 2012


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

             Bug #: 11683
           Summary: Detecting infinite loops
           Product: clang
           Version: 2.9
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: angusgh at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


It seems like it would be possible to cat a small subset of simple but common
infinite loops by checking whether the variables in the loop condition are
changed by either the condition check or the loop body. Sample code that this
would trigger on might look like this (yes, I've actually written this kind of
code, frequently, and it's not an error to gcc for obvious reasons).

int main()
{
    int i=10;

    while (i>0); //notice the semicolon
    {
        i--;
    }

    return 0;

}

This would also possibly be useful in a large set of cases where critical parts
of loops have been malformed.

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