www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23130] New: Inline asm lets you mov to half a variable.

https://issues.dlang.org/show_bug.cgi?id=23130

          Issue ID: 23130
           Summary: Inline asm lets you mov to half a variable.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxhaton gmail.com

void foo()
{
    long i = void;
    static assert(long.sizeof == 8);
    asm
    {
        mov EAX, i;
        mov i, EAX;
    }
}

In 64 bit mode this is correctly rejected, but in 32 bit mode long suddenly is
32 bit as far as the inline assembler is concerned.

--
May 20 2022