[Issue 19841] Wrong ABI for C++ functions taking a struct by value
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 7 05:04:12 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=19841
--- Comment #7 from Walter Bright <bugzilla at digitalmars.com> ---
Compiling the D version on Linux64 gives:
_D5test84oopsFZv:
push RBP
mov RBP,RSP
sub RSP,030h
lea RAX,-028h[RBP]
xor ECX,ECX
mov [RAX],RCX
mov 8[RAX],RCX
mov 010h[RAX],RCX
mov 018h[RAX],RCX
mov -8[RBP],CL
push dword ptr -010h[RBP]
push dword ptr -018h[RBP]
push dword ptr -020h[RBP]
push dword ptr -028h[RBP]
lea RDI,-8[RBP]
call _ZN3BarC1E3Foo at PC32
add RSP,020h
mov RSP,RBP
pop RBP
ret
which looks equivalent to the C++ code generated by kinke's godbolt example:
push rbp
mov rbp, rsp
sub rsp, 48
mov QWORD PTR [rbp-32], 0
mov QWORD PTR [rbp-24], 0
mov QWORD PTR [rbp-16], 0
mov QWORD PTR [rbp-8], 0
lea rax, [rbp-33]
push QWORD PTR [rbp-8]
push QWORD PTR [rbp-16]
push QWORD PTR [rbp-24]
push QWORD PTR [rbp-32]
mov rdi, rax
call Bar::Bar(Foo)
add rsp, 32
nop
leave
ret
So I'm going to mark this as worksforme.
--
More information about the Digitalmars-d-bugs
mailing list