[LLVMbugs] [Bug 5130] New: missed check for NULL and wrong value in structure
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sun Oct 4 05:30:14 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=5130
Summary: missed check for NULL and wrong value in structure
Product: clang
Version: unspecified
Platform: PC
OS/Version: FreeBSD
Status: NEW
Severity: normal
Priority: P2
Component: LLVM Codegen
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: rdivacky at freebsd.org
CC: llvmbugs at cs.uiuc.edu
we see miscompilation of FreeBSD kernel with TOT llvm/clang
the attached test case is basically this code:
static struct taskqueue *
_taskqueue_create(const char *name, int mflags,
taskqueue_enqueue_fn enqueue, void *context,
int mtxflags, const char *mtxname)
{
struct taskqueue *queue;
queue = malloc(sizeof(struct taskqueue), M_TASKQUEUE, mflags | M_ZERO);
(1) if (!queue)
return NULL;
STAILQ_INIT(&queue->tq_queue);
queue->tq_name = name;
queue->tq_enqueue = enqueue;
queue->tq_context = context;
queue->tq_spin = (mtxflags & MTX_SPIN) != 0;
(2) queue->tq_flags |= TQ_FLAGS_ACTIVE;
mtx_init(&queue->tq_mutex, mtxname, NULL, mtxflags);
return queue;
}
there are two miscompilations on amd64 (and I think on i386 too). (the
generated asm attached)
1) there is a check for queue being NULL at (1) which is ommited in the
generated asm
2) the code at (2) is
return queue;
}
there are two miscompilations on amd64 (and I think on i386 too). (the
generated asm attached)
1) there is a check for queue being NULL at (1) which is ommited in the
generated asm
2) the code at (2) is
queue->tq_spin = (mtxflags & 0x00000001) != 0;
gcc generates this code:
orl $1, 96(%rbx)
while clang/llvm generates
movl $-1, 96(%r13)
these bugs are quite recent as I recall compiling a running FreeBSD kernel as
of roughly 2 weeks ago.
--
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