[Issue 4506] -O flag breaks some recursive functions.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 25 09:33:41 PDT 2010


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



--- Comment #2 from bearophile_hugs at eml.cc 2010-07-25 09:33:40 PDT ---
Normal compilation:

__Dmain    comdat
    assume    CS:__Dmain
L0:        enter    8,0
        mov    dword ptr -8[EBP],1
        mov    dword ptr -4[EBP],0
L12:        cmp    dword ptr -4[EBP],2
        jge    L42
        cmp    dword ptr -4[EBP],0
        jne    L24
        cmp    dword ptr -8[EBP],1
        je    L3A
L24:        cmp    dword ptr -4[EBP],1
        jne    L30
        cmp    dword ptr -8[EBP],0FFFFFFFFh
        je    L3A
L30:        mov    EAX,4
        call    near ptr _D4test8__assertFiZv
L3A:        neg    dword ptr -8[EBP]
        inc    dword ptr -4[EBP]
        jmp short    L12
L42:        xor    EAX,EAX
        leave
        ret
__Dmain    ends
_D4test8__assertFiZv    comdat
    assume    CS:_D4test8__assertFiZv
L0:        enter    4,0
        push    EAX
        mov    ECX,offset FLAT:_D4test12__ModuleInfoZ
        push    ECX
        call    near ptr __d_assertm
        leave
        ret



With -O:

__Dmain    comdat
    assume    CS:__Dmain
L0:        push    EAX
        push    EBX
        xor    EBX,EBX
        push    ESI
        mov    ESI,1
LA:        test    EBX,EBX
        je    L18
        mov    EAX,4
        call    near ptr _D4test8__assertFiZv
L18:        neg    ESI
        inc    EBX
        cmp    EBX,2
        jb    LA
        pop    ESI
        xor    EAX,EAX
        pop    EBX
        pop    ECX
        ret
__Dmain    ends
_D4test8__assertFiZv    comdat
    assume    CS:_D4test8__assertFiZv
L0:        push    EAX
        mov    ECX,offset FLAT:_D4test12__ModuleInfoZ
        push    EAX
        push    ECX
        call    near ptr __d_assertm
        pop    EAX
        ret

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


More information about the Digitalmars-d-bugs mailing list