[Issue 10639] New: Win64: wrong optimizer codegen with struct literal with complex fields
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jul 14 06:13:55 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10639
Summary: Win64: wrong optimizer codegen with struct literal
with complex fields
Product: D
Version: D2
Platform: x86_64
OS/Version: Windows
Status: NEW
Keywords: wrong-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: r.sagitario at gmx.de
--- Comment #0 from Rainer Schuetze <r.sagitario at gmx.de> 2013-07-14 06:13:54 PDT ---
This source extracted from the phobos unittests:
struct S1
{
cdouble val;
}
void formatTest(S1 s, double re, double im)
{
assert(s.val.re == re);
assert(s.val.im == im);
}
unittest
{
S1 s = S1(3+2.25i);
formatTest(s, 3, 2.25);
}
void main() {}
compile with "dmd -unittest -m64 -O test.d" and run to see the assertions
failing.
This does not happen with -m32 or without -O.
Here is the disassembly of the unittest code:
_D4test15__unittestL12_1FZv:
0000000000000000: 55 push rbp
0000000000000001: 48 8B EC mov rbp,rsp
0000000000000004: 48 83 EC 10 sub rsp,10h
0000000000000008: 48 C7 45 F0 00 00 mov qword ptr [rbp-10h],0
00 00
0000000000000010: 48 C7 45 F8 00 00 mov qword ptr [rbp-8],0
00 00
0000000000000018: 4C 8D 45 F0 lea r8,[rbp-10h]
000000000000001C: F2 48 0F 10 0D 00 movsd xmm1,mmword ptr [_TMP3]
00 00 00
0000000000000025: F2 48 0F 10 05 00 movsd xmm0,mmword ptr [_TMP4]
00 00 00
000000000000002E: 48 83 EC 20 sub rsp,20h
0000000000000032: 66 48 0F 7E CA movd rdx,xmm1
0000000000000037: 66 48 0F 7E C1 movd rcx,xmm0
000000000000003C: E8 00 00 00 00 call
_D4test10formatTestFS4test2S1ddZv
0000000000000041: 48 83 C4 20 add rsp,20h
0000000000000045: 48 8D 65 00 lea rsp,[rbp]
0000000000000049: 5D pop rbp
000000000000004A: C3 ret
The struct literal is initialized with two 0 values at offset 8/10.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list