December 16, 2003
This D codes generates wrong machine codes (for Intel CPU) when -g flag is set.

class A {
int a;
void foo() {
a = 1;
asm { naked; ret; }
}
}

If -g flag is not set, this codes generates:

>> void foo {
>> a = 1;
C7 40 08 01 00 00 00: mov [EAX + 8], 1  <- EAX is `this'
>> asm { naked; ret; }
C3                  : ret
>> }

However, if -g flag is set:

>> void foo {
>> a = 1;
8B 45 FC            : mov EAX, [EBP - 4]  <- this code is added C7 40 08 01 00 00 00: mov [EAX + 8], 1
>> asm { naked; ret; }
C3                  : ret
>> }

The added code means it moves `this' into EAX register,
but [EBP - 4] is normally not `this', because `foo' is naked function.

Robert (Japanese)