[LLVMbugs] [Bug 19778] New: asm label with the same name as static variable leads to: Assertion failed: (Symbol->isUndefined() && "Cannot define a symbol twice!")
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun May 18 04:18:27 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19778
Bug ID: 19778
Summary: asm label with the same name as static variable leads
to: Assertion failed: (Symbol->isUndefined() &&
"Cannot define a symbol twice!")
Product: new-bugs
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: dimitry at andric.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
I received a bugreport about the following assertion failure in clang, when
building libglapi (a component of Mesa):
https://jenkins.freebsd.org/pci/head-i386/logs/bulk/headi386-default/753/logs/errors/libglapi-9.1.7.log
After some reducing, the testcase turns out to be very small:
__asm__("x86_entry_end:");
static x86_entry_end[];
entry_generate() {
int *code_templ = x86_entry_end - 1;
memcpy(0, code_templ, 32);
}
Compiling this with clang trunk r209086 (with assertions enabled), and any
optimization level above -O1, gives:
Assertion failed: (Symbol->isUndefined() && "Cannot define a symbol twice!"),
function EmitLabel, file /share/dim/src/llvm/trunk/lib/MC/MCAsmStreamer.cpp,
line 309.
[... etc ...]
The code in question originates here in the Mesa repository:
http://cgit.freedesktop.org/mesa/mesa/tree/src/mapi/entry_x86_tls.h#n46
Now the question is: is this "legal" in any sense? E.g. defining your own
inline asm label, which has the same name as a static char array? Mesa seems
to have this construction since some time, so gcc apparently has no trouble
with it.
In any case, I think clang should not assert on this. Either reject the
construction (but break Mesa), or deal with it. :)
--
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/20140518/1658a16c/attachment.html>
More information about the llvm-bugs
mailing list