<html>
<head>
<base href="https://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 --- - clang aarch64 compiler crash on inline constraints"
href="https://llvm.org/bugs/show_bug.cgi?id=28633">28633</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang aarch64 compiler crash on inline constraints
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.8
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>fbarchard@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>This inline aarch64 function causes a segfault in clang
// This function known to cause compiler fault on clang 64 bit.
int saturate_32bit_to_16bit(int a) {
int ret;
asm volatile ("sqxtn h0, %s[a]\n"
"sxtl v0.4s, v0.4h\n"
"fmov %w[ret], s0\n"
: [ret] "=&r" (ret)
: [a] "w" (a)
: "v0" );
return ret;
}
Expected Results:
same as gcc - generate valid code.
Actual Results:
./clang saturate_test.c -O2 -target aarch64-none-linux-android -c
.../saturate_test.c:5:19: error: couldn't allocate input reg for constraint 'w'
asm volatile ("sqxtn h0, %s[a]\n"
^
clang-3.8: error: unable to execute command: Segmentation fault (core dumped)
clang-3.8: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.1
Target: aarch64-none-linux-android
Thread model: posix
This also fails:
static inline int saturate_32bit_to_16bit(int a) {
int ret;
asm volatile ("sqxtn %h[ret], %s[a]\n"
"sxtl %[ret].4s, %[ret].4h\n"
: [ret] "=w" (ret)
: [a] "w" (a)
:);
return ret;
}
This works
static inline int saturate_32bit_to_16bit(int a) {
int ret;
asm volatile ("fmov s0, %w[a]\n"
"sqxtn h0, s0\n"
"sxtl v0.4s, v0.4h\n"
"fmov %w[ret], s0\n"
: [ret] "=&r" (ret)
: [a] "r" (a)
: "v0" );
return ret;
}
This similar function works
static inline int saturate_float_to_16bit(float a) {
int ret;
asm volatile ("fcvtas %s[ret], %s[a]\n"
"sqxtn %h[ret], %s[ret]\n"
"sxtl %[ret].4s, %[ret].4h\n"
: [ret] "=w" (ret)
: [a] "w" (a)
:);
return ret;
}
Additional Information:
all variations work ok in gcc 4.9
Tested/fails on OSX and Linux.</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>