[Issue 5819] New: DMD doesn't error/warn about illegal asm for 64bit mode

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 8 09:31:14 PDT 2011


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

           Summary: DMD doesn't error/warn about illegal asm for 64bit
                    mode
           Product: D
           Version: D1 & D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: ibuclaw at ubuntu.com


--- Comment #0 from Iain Buclaw <ibuclaw at ubuntu.com> 2011-04-08 09:27:35 PDT ---
64bit DMD will happily compile this and emit a bad executable.

void main()
{
    // All the following should be illegal for x86-64
    asm {
        aaa;            // illegal
        aad;            // illegal
        aam;            // illegal
        aas;            // illegal
        daa;            // illegal
        das;            // illegal
        into;           // illegal
        pop DS;         // illegal
        pop ES;         // illegal
        pop SS;         // illegal
        popa;           // illegal
        push CS;        // illegal
        push DS;        // illegal
        push ES;        // illegal
        push SS;        // illegal
        pusha;          // illegal
        pushf;          // illegal
        popf;           // illegal


        // Miscellaneous issue: 
        // DMD silently replaces EAX with RAX, etc, etc.
        // Should really be an error.
        pop EAX;        // can't have 32-bit stack operands in 64bit mode
        push EAX;       // can't have 32-bit stack operands in 64bit mode
    }
}


Regards

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