[llvm-bugs] [Bug 50754] New: AArch64 inline asm does not explain why X19 is reserved
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jun 17 06:30:49 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50754
Bug ID: 50754
Summary: AArch64 inline asm does not explain why X19 is
reserved
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: AArch64
Assignee: unassignedbugs at nondot.org
Reporter: david.spickett at linaro.org
CC: arnaud.degrandmaison at arm.com,
llvm-bugs at lists.llvm.org, smithp352 at googlemail.com,
Ties.Stuij at arm.com
Compiling the following:
extern void fn1(char*);
extern void fn2(int*);
int a;
int main() {
char b[a];
fn1(b);
__asm("nop" : : : "x19");
int c[64];
fn2(c);
return 0;
}
With:
./bin/clang --target=aarch64-linux-gnu -c -O0 test.c
Gives the following warning:
warning: inline asm clobber list contains reserved registers: X19
[-Winline-asm]
__asm("nop" : : : "x19");
^
note: Reserved registers on the clobber list may not be preserved across the
asm statement, and clobbering them may lead to undefined behaviour.
1 warning generated.
The warning is not present when compiling with GCC.
https://godbolt.org/z/3r74Gq6c8
This is because llvm uses X19 as the base pointer for the stack frame. Or at
least, it does when it needs to. So small changes to the code shown can mean
you get a warning or not. (which is correct, but confusing if you're trying to
understand what's going on)
For the frame pointer X29 you get "FP" instead which is more obvious. Even if
you just got "X29" you could look at the ABI docs.
inline asm clobber list contains reserved registers: X19, FP [-Winline-asm]
The base pointer register is not assigned by the ABI it's up to the compiler so
it'd be good to add some explanation to this message.
Perhaps:
note: llvm uses X19 as the stack frame base pointer register.
--
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/20210617/c271094c/attachment.html>
More information about the llvm-bugs
mailing list