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.
https://github.com/D-Programming-Language/dmd/pull/2359
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a3d33e3937d42fdead489a7f04413583f4451491 fix Issue 10639 - Win64: wrong optimizer codegen with struct literal with complex fields https://github.com/D-Programming-Language/dmd/commit/de687981f72b0256b1dc1233306b4cfe94db626c Merge pull request #2359 from WalterBright/fix10639 fix Issue 10639 - Win64: wrong optimizer codegen with struct literal with complex fields
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6f38739b45f65f1173db4401fdb88c583937fd76 Merge pull request #2359 from WalterBright/fix10639 fix Issue 10639 - Win64: wrong optimizer codegen with struct literal with complex fields