[llvm-bugs] [Bug 32917] New: Miscompilation when targeting AArch64 from Windows
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu May 4 02:43:09 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=32917
Bug ID: 32917
Summary: Miscompilation when targeting AArch64 from Windows
Product: libraries
Version: 3.9
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Interprocedural Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: martin at martin.st
CC: llvm-bugs at lists.llvm.org
Created attachment 18407
--> https://bugs.llvm.org/attachment.cgi?id=18407&action=edit
Reduced test case
When targeting AArch64, clang on Windows can miscompile code, while the exact
same clang version on Linux and OS X compiles it correctly.
The following reduced code snippet shows the issue:
a, b;
static fn1(*p1) { a = p1[-1]; }
fn2() { fn1(b); }
When built with -O3 for AArch64, it produces the following disassembly:
0000000000000000 <fn2>:
0: 90000008 adrp x8, 4 <fn2+0x4>
4: f9400108 ldr x8, [x8]
8: 90000009 adrp x9, 4 <fn2+0x4>
c: b9800108 ldrsw x8, [x8]
10: b85fc108 ldur w8, [x8,#-4]
14: f9400129 ldr x9, [x9]
18: b9000128 str w8, [x9]
1c: d65f03c0 ret
When built on Windows, it instead produces the following disassembly:
0000000000000000 <fn2>:
0: 90000008 adrp x8, 4 <fn2+0x4>
4: f9400108 ldr x8, [x8]
8: b27e7fe9 mov x9, #0x3fffffffc // #17179869180
c: b9800108 ldrsw x8, [x8]
10: b8696908 ldr w8, [x8,x9]
14: 90000009 adrp x9, 4 <fn2+0x4>
18: f9400129 ldr x9, [x9]
1c: b9000128 str w8, [x9]
20: d65f03c0 ret
To reproduce the issue, build with "clang -target aarch64-none-linux-android
-O3 -c aarch64-miscompilation.c -o test.o" and disassemble e.g. with
"aarch64-linux-gnu-objdump -d test.o".
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170504/764e0eeb/attachment.html>
More information about the llvm-bugs
mailing list