[LLVMbugs] [Bug 19161] New: Analyzer does not realise list is not empty

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 17 01:47:37 PDT 2014


            Bug ID: 19161
           Summary: Analyzer does not realise list is not empty
           Product: clang
           Version: 3.3
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: peter at stairways.com.au
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The analyzer (in Xcode 5.1) reports a "Use of memory after it is freed" if you
test for !empty and then access a list.  Perhaps I'm missing something, or
maybe this is just too hard for the analyser?

#include <list>

struct QueueEntry {
    bool writer;

static std::list<QueueEntry> i_actionQueue;

int main(int argc, const char * argv[])
     while ( !i_actionQueue.empty() && i_actionQueue.begin()->writer ) {

    return 0;

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/20140317/eadb2b51/attachment.html>

More information about the llvm-bugs mailing list