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

            Bug ID: 15297
           Summary: False positive in sys/queue.h
           Product: clang
           Version: 3.2
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 10038
  --> http://llvm.org/bugs/attachment.cgi?id=10038&action=edit
Preprocessed file

This completely normal usage of the BSD sys/queue.h TAILQ becomes a false
positive in the remove line:

#include <stdlib.h>
#include <sys/queue.h>

struct foo
{
    TAILQ_ENTRY(foo) link;
};

TAILQ_HEAD(, foo) queue;

int
main(int argc, char *argv[])
{
    struct foo *el;

    TAILQ_INIT(&queue);


    el = malloc(sizeof (*el));
    TAILQ_INSERT_TAIL(&queue, el, link);
    el = malloc(sizeof (*el));
    TAILQ_INSERT_TAIL(&queue, el, link);

    while ((el = TAILQ_FIRST(&queue)))
    {
        TAILQ_REMOVE(&queue, el, link);
        free(el);
    }
    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