<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - asm label with the same name as static variable leads to: Assertion failed: (Symbol->isUndefined() && "Cannot define a symbol twice!")"
href="http://llvm.org/bugs/show_bug.cgi?id=19778">19778</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>asm label with the same name as static variable leads to: Assertion failed: (Symbol->isUndefined() && "Cannot define a symbol twice!")
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dimitry@andric.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I received a bugreport about the following assertion failure in clang, when
building libglapi (a component of Mesa):
<a href="https://jenkins.freebsd.org/pci/head-i386/logs/bulk/headi386-default/753/logs/errors/libglapi-9.1.7.log">https://jenkins.freebsd.org/pci/head-i386/logs/bulk/headi386-default/753/logs/errors/libglapi-9.1.7.log</a>
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:
<a href="http://cgit.freedesktop.org/mesa/mesa/tree/src/mapi/entry_x86_tls.h#n46">http://cgit.freedesktop.org/mesa/mesa/tree/src/mapi/entry_x86_tls.h#n46</a>
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. :)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>