spurious gc allocation

Ellery Newcomer ellery-newcomer at utulsa.edu
Fri Nov 8 19:11:08 PST 2013


On 11/08/2013 06:19 AM, Timon Gehr wrote:
> On 11/08/2013 07:12 AM, Benjamin Thaut wrote:
>>
>>
>> The problem is that you define the struct Thing as a inner struct.
>
> struct Thing only exists in the decompiled version, not in the original
> source. So far it looks like a bug to me.

I've reduced it to the following:

a.d:
class C
{
     void _InsertAllBut(int v) {
         int* node = null;
         enum mutable = __traits(compiles, {node.value ;});
     }

}

test.d:
import a;

void main () {
     C c = new C();
     c._InsertAllBut(1);
}


compile:

dmd test.d a.d

order doesn't seem to matter, works with -m32 and -m64, apparently I am 
running dmd v2.063-devel-e23c785

objdump -d --disassembler-options=intel test | ddemangle

shows me

...
0000000000417888 <void a.C._InsertAllBut(int)>:
   417888:       55                      push   rbp
   417889:       48 8b ec                mov    rbp,rsp
   41788c:       48 83 ec 38             sub    rsp,0x38
   417890:       53                      push   rbx
   417891:       48 89 7d f0             mov    QWORD PTR [rbp-0x10],rdi
   417895:       48 bf 10 00 00 00 00    movabs rdi,0x10
   41789c:       00 00 00
   41789f:       e8 10 22 00 00          call   419ab4 <_d_allocmemory>
   4178a4:       48 89 45 e0             mov    QWORD PTR [rbp-0x20],rax
   4178a8:       48 8b 4d f0             mov    rcx,QWORD PTR [rbp-0x10]
   4178ac:       48 89 08                mov    QWORD PTR [rax],rcx
   4178af:       48 85 c9                test   rcx,rcx
...


can anyone confirm?


More information about the Digitalmars-d-learn mailing list