www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21181] New: Inline Assmbler compiles long ptr as a byte

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

          Issue ID: 21181
           Summary: Inline Assmbler compiles long ptr as a byte operation
                    for 32 bit compiles
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

The following code:

  uint func()
  {
    asm
    {
        naked;
        inc [EAX];
        inc byte ptr [EAX];
        inc short ptr [EAX];
        inc int ptr [EAX];
        inc long ptr [EAX];
    }
  }

generates:

  __D5test24funcFZk:
        inc     byte ptr [EAX]
        inc     byte ptr [EAX]
        inc     word ptr [EAX]
        inc     dword ptr [EAX]
        inc     byte ptr [EAX]   <== !!!!!

The last instruction should be rejected by the compiler.

--
Aug 21 2020