<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Error in backend: Cannot encode high byte register in REX-prefixed instruction"
href="https://bugs.llvm.org/show_bug.cgi?id=34751">34751</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Error in backend: Cannot encode high byte register in REX-prefixed instruction
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>douglas_yung@playstation.sony.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>We hit this crash in the compiler which was introduced in r314151, fixed in
r314199 (a revert of r314151), and then reintroduced in r314249 which was a
recommit of r314151.
Here is the repro that we came up with:
/* test.c */
struct S {
unsigned char *buf;
unsigned int p;
unsigned int w;
unsigned long a;
};
extern unsigned long foo();
int bar(struct S * s) {
s->a = foo();
unsigned int h = (s->w) << 8;
if (s)
h |= 0x20;
h += 31 - (h % 31);
s->buf[s->p++] = h >> 8;
s->buf[0] = h;
return s->p != 0;
}
If you compile this on linux with "-O2 -march=btver2", you get the following
crash:
clang version 6.0.0 (trunk 314249)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/dyung/src/upstream/314249-linux/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.1.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.1
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/home/dyung/src/upstream/314249-linux/bin/clang-6.0" -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name test.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu btver2
-dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -v
-coverage-notes-file /home/dyung/sandbox/184159/test.gcno -resource-dir
/home/dyung/src/upstream/314249-linux/lib/clang/6.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/dyung/src/upstream/314249-linux/lib/clang/6.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fdebug-compilation-dir /home/dyung/sandbox/184159 -ferror-limit 19
-fmessage-length 0 -fobjc-runtime=gcc -fdiagnostics-show-option
-vectorize-loops -vectorize-slp -o test.o -x c test.c
clang -cc1 version 6.0.0 based upon LLVM 6.0.0 default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/home/dyung/src/upstream/314249-linux/lib/clang/6.0.0/include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
fatal error: error in backend: Cannot encode high byte register in REX-prefixed
instruction
clang-6.0: error: clang frontend command failed with exit code 70 (use -v to
see invocation)
clang version 6.0.0 (trunk 314249)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/dyung/src/upstream/314249-linux/bin
clang-6.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-6.0: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-6.0: note: diagnostic msg: /tmp/test-c4d6b5.c
clang-6.0: note: diagnostic msg: /tmp/test-c4d6b5.sh
clang-6.0: note: diagnostic msg:
********************</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>