[LLVMbugs] [Bug 14797] New: Analyzer gets confused by decrementing loops

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 4 12:23:44 PST 2013


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

             Bug #: 14797
           Summary: Analyzer gets confused by decrementing loops
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: florob at babelmonkeys.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Apparently the analyzers data flow analysis apparently gets confused by loops
which count downwards. Below is a small testcase, which works fine when the
first loop is changed to increment. As is the static analyzer claims
uninitialized values in the second loop;

#include <assert.h>
void foo(int len)
{
    int a[5], b;

    assert((len > 0) && (len <= 5));

    for (int i = len-1; i >= 0; i--)
        a[i] = 0;

    for (int i = len-1; i >= 0; i--)
        b = a[i];
}

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