<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 --- - "optimized" __atomic_*_{1,2,4,8,16} libcalls use broken calling convention"
href="http://llvm.org/bugs/show_bug.cgi?id=20780">20780</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>"optimized" __atomic_*_{1,2,4,8,16} libcalls use broken calling convention
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>richard-llvm@metafoo.co.uk
</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>Consider:
double a, b, c; void g() { __atomic_exchange(&a, &b, &c, 5); }
unsigned long long d, e, f; void h() { __atomic_exchange(&d, &e, &f, 5); }
Clang generates this nonsense:
define void @_Z1gv() #0 {
entry:
%0 = load double* @b, align 4
%call = call double @__atomic_exchange_8(i8* bitcast (double* @a to i8*),
double %0, i32 5)
ret void
}
declare double @__atomic_exchange_8(i8*, double, i32)
define void @_Z1hv() #0 {
entry:
%0 = load i64* @e, align 4
%call = call i64 bitcast (double (i8*, double, i32)* @__atomic_exchange_8 to
i64 (i8*, i64, i32)*)(i8* bitcast (i64* @d to i8*), i64 %0, i32 5)
ret void
}
Note that we bitcast the function and use the wrong calling convention for both
calls.</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>