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

            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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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 ) {
          i_actionQueue.pop_front();
    }

    return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to