[llvm-bugs] [Bug 51713] New: __builtin_frame_address(0) returning RSP for x86_64-windows (instead of RBP)
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Sep 2 03:53:59 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51713
Bug ID: 51713
Summary: __builtin_frame_address(0) returning RSP for
x86_64-windows (instead of RBP)
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: xtkoba at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
Created attachment 25219
--> https://bugs.llvm.org/attachment.cgi?id=25219&action=edit
Repro
$ cat frameaddr.c
void bar(int *n);
void foo(int **p, int n)
{
__asm__ __volatile__ ("nop");
*p = __builtin_frame_address(0);
__asm__ __volatile__ ("nop");
bar(&n);
}
$ clang --target=x86_64-windows frameaddr.c -c -o - | llvm-objdump -d -
<stdin>: file format coff-x86-64
Disassembly of section .text:
0000000000000000 <foo>:
0: 55 pushq %rbp
1: 48 83 ec 30 subq $48, %rsp
5: 48 8d 6c 24 30 leaq 48(%rsp), %rbp
a: 89 55 fc movl %edx, -4(%rbp)
d: 48 89 4d f0 movq %rcx, -16(%rbp)
11: 90 nop
12: 48 8d 4d d0 leaq -48(%rbp), %rcx
16: 48 8b 45 f0 movq -16(%rbp), %rax
1a: 48 89 08 movq %rcx, (%rax)
1d: 90 nop
1e: 48 8d 4d fc leaq -4(%rbp), %rcx
22: e8 00 00 00 00 callq 0x27 <foo+0x27>
27: 90 nop
28: 48 83 c4 30 addq $48, %rsp
2c: 5d popq %rbp
2d: c3 retq
The instruction "leaq -48(%rbp), %rcx" at 0x12 should instead be something like
"movq %rbp, %rcx".
I don't know whether this is expected, but this behavior breaks
__builtin_longjmp for x86_64-windows (PR50142).
--
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/20210902/c6aa3d91/attachment-0001.html>
More information about the llvm-bugs
mailing list