[llvm-bugs] [Bug 31721] New: [ARM] MC crashes with LDREXD inline assembly
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jan 23 08:21:39 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31721
Bug ID: 31721
Summary: [ARM] MC crashes with LDREXD inline assembly
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: ARM
Assignee: unassignedbugs at nondot.org
Reporter: renato.golin at linaro.org
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
While investigating Bug #31058, I found that the MC layer is crashing on a
syntax previously accepted by 3.9 Clang on ARM mode:
void foo(long long *ptr, long long value) {
int store_failed;
__asm__ __volatile__(
"1:\n"
// Dummy load to lock cache line.
"ldrexd %1, [%2]\n"
"teq %0, #0\n"
"bne 1b"
: "=&r" (store_failed)
: "r"(value), "r" (ptr)
: "cc", "memory");
}
$ clang -S -O2 -target armv7a ldrexd.c -o -
llvm/include/llvm/MC/MCInst.h:75: int64_t llvm::MCOperand::getImm() const:
Assertion `isImm() && "This is not an immediate"' failed.
However, since the syntax proposed in bug #31058 works:
void foo(long long *ptr, long long value) {
int store_failed;
__asm__ __volatile__(
"1:\n"
// Dummy load to lock cache line.
"ldrexd %1, %H1, [%2]\n"
"teq %0, #0\n"
"bne 1b"
: "=&r" (store_failed)
: "r"(value), "r" (ptr)
: "cc", "memory");
}
and is preferred, we may just emit an error for this GNU syntax. Or we can fix
it and make it work on Thumb and ARM. Whatever is easier.
Also, LLVM is currently emitting an error for Thumb:
strexd.c:7:8: error: instruction requires: arm-mode
"ldrexd %1, [%3]\n"
strexd.c:8:8: error: instruction requires: arm-mode
"strexd %0, %2, [%3]\n"
which may or may not be related to bug #31720.
--
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/20170123/f7468f81/attachment-0001.html>
More information about the llvm-bugs
mailing list