http://d.puremagic.com/issues/show_bug.cgi?id=3634



--- Comment #1 from Witold Baryluk <bary...@smp.if.uj.edu.pl> 2009-12-18 
22:59:08 PST ---
Original code (with "private") fails also with "-O", "-O -inline", and many
others.

Here is simplified case:

class A {
    this() {
        x_ = 0x40;
    }
private:
    uint x_;
//public:
    uint x()
    out(ret) {
        pppp(ret);
    }
    body {
        return x_;
    }
}
import std.stdio;
void main() {     auto a = new A(); }
void pppp(uint xxx) {    xxx ++; }

.text._D1t1A1xMFZk      segment
        assume  CS:.text._D1t1A1xMFZk
_D1t1A1xMFZk:
                push    EBP
                mov     EBP,ESP
                sub     ESP,8
                mov     ECX,8[EAX]   // move field x_ to the ECX register
                mov     -8[EBP],ECX  // save ret in EBP[-8]
                xor     EAX,EAX       // set ret = 0
                call    near ptr _d1t4ppppf...@pc32 // call pppp(EAX)
                mov     EAX,-8[EBP] // restore ret after return from ppp
                leave
                ret   // return
.text._D1t1A1xMFZk      ends

When changed to "public":

.text._D1t1A1xMFZk      segment
        assume  CS:.text._D1t1A1xMFZk
_D1t1A1xMFZk:
                push    EBP
                mov     EBP,ESP
                sub     ESP,8
                mov     -4[EBP],EAX
                call    near ptr _d9invariant12_d_invariantfc6objec...@pc32
                mov     EAX,-4[EBP]
                mov     ECX,8[EAX]
                mov     -8[EBP],ECX
                lea     EDX,-8[EBP]
                push    EDX
                call    near ptr _d1t1a1xmfzk8__ensuremfkx...@pc32
                mov     EAX,-8[EBP]
                leave
                ret
                nop
                nop
                nop
.text._D1t1A1xMFZk      ends
.text._D1t1A1xMFZk8__ensureMFKxkZv      segment
        assume  CS:.text._D1t1A1xMFZk8__ensureMFKxkZv
_D1t1A1xMFZk8__ensureMFKxkZv:
                push    EBP
                mov     EBP,ESP
                sub     ESP,4
                mov     ECX,8[EBP]  // take address of field x_ and put into
ECX
                mov     EAX,[ECX] // move content of field x_ into EAX
                call    near ptr _d1t4ppppf...@pc32 // call pppp(EAX)
                leave
                ret     4 // return
.text._D1t1A1xMFZk8__ensureMFKxkZv      ends

_d9invariant12_d_invariantfc6objec...@pc32 is and Object.invariant() from base
class.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to