<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 --- - Header cpuid.h assembly breaks"
href="http://llvm.org/bugs/show_bug.cgi?id=20311">20311</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Header cpuid.h assembly breaks
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</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>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>gjasny@googlemail.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>Hello,
the following occured with Xcode 5.1.1 but I don't see why it cannot occur also
with the header file shipped with clang.
I put the following into radar bug #17686779
Summary:
Hello,
I'm using Xcode 5.1.1(clang-503.0.40) on 10.10 DP3 and build 32bit i386
binaries.
The __cpuid macro from cupid.h:
__asm(" pushl %%ebx\n" \
" cpuid\n" \
" mov %%ebx,%1\n" \
" popl %%ebx" \
: "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
: "0"(__level))
gets compiled into:
0x3921f5: cpuid
0x3921f7: movl %ebx, %ebx
0x3921f9: popl %ebx
The push/pop is used to preserve the pic register ebx across calls, but this
fails if ebx itself is picked as alternative register (=r) because the cpuid
output in ebx never reaches the target.
Steps to Reproduce:
I was not able to produce a minimal testcase because there esi was used instead
of ebx and the precondition for this bug was not met.
Expected Results:
The compiler must be told to not use ebx for the =r constraint.
Replacing =r in this macro with =S fixes the bug for me.
Actual Results:
Broken code
Version:
Xcode Version 5.1.1 (5B1008) (clang-503.0.40) on 10.10 DP3</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>