[LLVMbugs] [Bug 12531] New: Reverse loop order with variable upper boundary not handled correctly by analyzer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 12 03:27:25 PDT 2012


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

             Bug #: 12531
           Summary: Reverse loop order with variable upper boundary not
                    handled correctly by analyzer
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: joerg at NetBSD.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Consider this code:

void f(int j)
{
        void *buf[j];
        int i;
        if (j < 0)
                return;
        for (i = 0; i < j; ++i)
                buf[i] = malloc(100);
#if WORKING
        for (i = 0; i < j; ++i)
#else
        for (i = j - 1; i >= 0; ++i)
#endif
                free(buf[i]);
}

The two for loops in the #if are equivalent, but the second triggers the "use
of potentially uninitialised memory" check.

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