<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 - JITting of x32 code on x64 fails with crash or instruction selection error."
href="https://bugs.llvm.org/show_bug.cgi?id=34268">34268</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>JITting of x32 code on x64 fails with crash or instruction selection error.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>4.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</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>OrcJIT
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>1101.debian@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>I compile a simple code:
// main.c
#include <stdio.h>
int square(int x) {
return x * x;
}
int main() {
printf("%d\n", square(4));
return 0;
}
Using the following command:
<span class="quote">> clang-4.0 main.c -c -emit-llvm -m32</span >
Then I try to run the bitcode using lli. Based on jit kind it either crashes or
shows an instruction selection error:
<span class="quote">> lli-4.0 -jit-kind=orc-mcjit main.bc</span >
0 libLLVM-4.0.so.1 0x00007fa69adc49a8
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 56
1 libLLVM-4.0.so.1 0x00007fa69adc2b2e llvm::sys::RunSignalHandlers() + 62
2 libLLVM-4.0.so.1 0x00007fa69adc2c7c
3 libpthread.so.0 0x00007fa69a4aa390
4 libpthread.so.0 0x00007fa69d81e026
Stack dump:
0. Program arguments: lli-4.0 -jit-kind=orc-mcjit main.bc
fish: “lli-4.0 -jit-kind=orc-mcjit mai…” terminated by signal SIGSEGV (Address
boundary error)
<span class="quote">> lli-4.0 main.bc</span >
0 libLLVM-4.0.so.1 0x00007f2377ae19a8
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 56
1 libLLVM-4.0.so.1 0x00007f2377adfb2e llvm::sys::RunSignalHandlers() + 62
2 libLLVM-4.0.so.1 0x00007f2377adfc7c
3 libpthread.so.0 0x00007f23771c7390
4 libpthread.so.0 0x00007f237a53b026
Stack dump:
0. Program arguments: lli-4.0 main.bc
fish: “lli-4.0 main.bc” terminated by signal SIGSEGV (Address boundary error)
<span class="quote">> lli-4.0 -jit-kind=orc-lazy main.bc</span >
LLVM ERROR: Cannot select: 0x199d480: ch,glue = X86ISD::CALL 0x199d418,
0x199d758, Register:i32 %EDI, Register:i32 %ESI, Register:i8 %AL,
RegisterMask:Untyped, 0x199d418:1
0x199d758: i32 = X86ISD::Wrapper TargetGlobalAddress:i32<i32 (i8*, ...)*
@printf> 0
0x199d140: i32 = TargetGlobalAddress<i32 (i8*, ...)* @printf> 0
0x199ce00: i32 = Register %EDI
0x199d2e0: i32 = Register %ESI
0x199d3b0: i8 = Register %AL
0x199ced0: Untyped = RegisterMask
0x199d418: ch,glue = CopyToReg 0x199d348, Register:i8 %AL, Constant:i8<0>,
0x199d348:1
0x199d3b0: i8 = Register %AL
0x199d210: i8 = Constant<0>
0x199d348: ch,glue = CopyToReg 0x199d278, Register:i32 %ESI, 0x199d070,
0x199d278:1
0x199d2e0: i32 = Register %ESI
0x199d070: i32,ch,glue = CopyFromReg 0x199cfa0, Register:i32 %EAX,
0x199cfa0:1
0x199d008: i32 = Register %EAX
0x199cfa0: ch,glue = callseq_end 0x199cf38, TargetConstant:i32<0>,
TargetConstant:i32<0>, 0x199cf38:1
0x199cd30: i32 = TargetConstant<0>
0x199cd30: i32 = TargetConstant<0>
0x199cf38: ch,glue = X86ISD::CALL 0x199ce68, 0x199d7c0, Register:i32
%EDI, RegisterMask:Untyped, 0x199ce68:1
0x199d7c0: i32 = X86ISD::Wrapper TargetGlobalAddress:i32<i32 (i32)*
@square> 0
0x199d0d8: i32 = TargetGlobalAddress<i32 (i32)* @square> 0
0x199ce00: i32 = Register %EDI
0x199ced0: Untyped = RegisterMask
0x199ce68: ch,glue = CopyToReg 0x199cd98, Register:i32 %EDI,
Constant:i32<4>
0x199ce00: i32 = Register %EDI
0x199ccc8: i32 = Constant<4>
0x199d278: ch,glue = CopyToReg 0x199d1a8, Register:i32 %EDI, 0x199d6f0
0x199ce00: i32 = Register %EDI
0x199d6f0: i32 = X86ISD::Wrapper TargetGlobalAddress:i32<[4 x i8]*
@"$static.0"> 0
0x199d688: i32 = TargetGlobalAddress<[4 x i8]* @"$static.0"> 0
In function: main
===
I tested it only on Linux, but other systems might be affected as well.</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>