[LLVMbugs] [Bug 15297] New: False positive in sys/queue.h

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 19 03:24:31 PST 2013


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: kremenek at apple.com
          Reporter: pelle at morth.org
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130219/61ccc318/attachment.html>


More information about the llvm-bugs mailing list