[Issue 8199] New: scope exit breaks stack alignment

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 5 04:11:58 PDT 2012


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

           Summary: scope exit breaks stack alignment
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: FreeBSD
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dawg at dawgfoto.de


--- Comment #0 from dawg at dawgfoto.de 2012-06-05 04:13:58 PDT ---
cat > bug.d << CODE
void checkAlign()
{
    asm
    {
        naked;
        mov RDI, RSP;
        and RDI, 0xF;
        cmp RDI, 0x8;
        je Lpass;
        hlt;
    Lpass:
        ret;
    }
}

void foo()
{
}

void main()
{
    checkAlign();
    scope(exit) checkAlign();
    foo();
}
CODE

dmd -run bug

----

The scope exit pushes the address of the return block onto the stack
which breaks the stack alignment.

-- 
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