[Issue 17885] Unable to remove a tuple from associative array.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 8 21:02:26 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=17885

ag0aep6g at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |ag0aep6g at gmail.com
          Component|druntime                    |dmd

--- Comment #1 from ag0aep6g at gmail.com ---
I think this is a wrong-code bug in the compiler.

For this D code:

----
struct T { ulong a, b; }
T f() { return T(); }

void main()
{
    int[T] set;
    set.remove(f());
}
----

dmd generates this machine code for _Dmain (excerpt):

----
   0x00000000000300ba <+14>:    call   0x30090 <_D4test1fFZSQk1T>
   0x00000000000300bf <+19>:    mov    QWORD PTR [rbp-0x8],rax
   0x00000000000300c3 <+23>:    lea    rdx,[rbp-0x8]
   0x00000000000300c7 <+27>:    lea    rsi,[rip+0x238f42]        # 0x269010
<_D17TypeInfo_S4test1T6__initZ>
   0x00000000000300ce <+34>:    mov    rdi,QWORD PTR [rbp-0x10]
   0x00000000000300d2 <+38>:    call   0x303c0 <_aaDelX>
----

Note that after the `f` call, only rax gets copied to the stack. But the other
half of the return value is in rdx which is not being copied.

Changing component to dmd.

--


More information about the Digitalmars-d-bugs mailing list