Bug 10677 – Win64: cfloat return value not forwarded correctly as function argument

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2013-07-20T00:57:00Z
Last change time
2015-06-09T05:10:43Z
Keywords
wrong-code
Assigned to
nobody
Creator
r.sagitario

Comments

Comment #0 by r.sagitario — 2013-07-20T00:57:23Z
Another one from the phobos unittests that I hoped was covered by other reports: /////////////////////////////// void formatTest2(cfloat s, double re, double im) { assert(s.re == re); assert(s.im == im); } cfloat getcf() { return 2 + 1i; } unittest { formatTest2( getcf(), 2, 1 ); } void main() {} ////////////////////////////// compile with "dmd -m64 -unittest test.d" to trigger the assertion. Here's the disassembly: _D4test5getcfFZq: 0000000000000000: 55 push rbp 0000000000000001: 48 8B EC mov rbp,rsp 0000000000000004: 48 83 EC 10 sub rsp,10h 0000000000000008: D9 05 00 00 00 00 fld dword ptr [_TMP0] 000000000000000E: D9 05 04 00 00 00 fld dword ptr [_TMP0+4] 0000000000000014: D9 5D F0 fstp dword ptr [rbp-10h] 0000000000000017: F3 0F 10 4D F0 movss xmm1,dword ptr [rbp-10h] 000000000000001C: D9 5D F0 fstp dword ptr [rbp-10h] 000000000000001F: F3 0F 10 45 F0 movss xmm0,dword ptr [rbp-10h] 0000000000000024: 48 8D 65 00 lea rsp,[rbp] 0000000000000028: 5D pop rbp 0000000000000029: C3 ret _D4test15__unittestL13_1FZv: 0000000000000000: 55 push rbp 0000000000000001: 48 8B EC mov rbp,rsp 0000000000000004: 48 83 EC 10 sub rsp,10h 0000000000000008: 48 83 EC 20 sub rsp,20h 000000000000000C: E8 00 00 00 00 call _D4test5getcfFZq 0000000000000011: 48 83 C4 20 add rsp,20h 0000000000000015: 49 89 C0 mov r8,rax 0000000000000018: F2 48 0F 10 0D 00 movsd xmm1,mmword ptr [_TMP1] 00 00 00 0000000000000021: 48 B8 00 00 00 00 mov rax,3FF0000000000000h 00 00 F0 3F 000000000000002B: 48 89 45 F0 mov qword ptr [rbp-10h],rax 000000000000002F: F2 0F 10 45 F0 movsd xmm0,mmword ptr [rbp-10h] 0000000000000034: 48 83 EC 20 sub rsp,20h 0000000000000038: 66 48 0F 7E CA movd rdx,xmm1 000000000000003D: 66 48 0F 7E C1 movd rcx,xmm0 0000000000000042: E8 00 00 00 00 call _D4test11formatTest2FqddZv 0000000000000047: 48 83 C4 20 add rsp,20h 000000000000004B: 48 8D 65 00 lea rsp,[rbp] 000000000000004F: 5D pop rbp 0000000000000050: C3 ret getcf returns the result in xmm0 and xmm1, but it is expected in rax by the caller.
Comment #1 by bugzilla — 2013-07-20T21:11:32Z
Comment #2 by github-bugzilla — 2013-07-21T23:36:46Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/dcebbd99140bcec147522be779cdc00af8fc70ff fix Issue 10677 - Win64: cfloat return value not forwarded correctly as function argument https://github.com/D-Programming-Language/dmd/commit/bbcd96872ea1afe719adf97675985517217837fa Merge pull request #2371 from WalterBright/fix10677 fix Issue 10677 - Win64: cfloat return value not forwarded correctly as ...
Comment #3 by github-bugzilla — 2013-07-22T11:51:00Z
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f70a40257e73fcd6e37e7208776b29e1e5d2f6aa Merge pull request #2371 from WalterBright/fix10677 fix Issue 10677 - Win64: cfloat return value not forwarded correctly as ...