[Issue 2617] asm silently accepts ambiguous-sized operations

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 21 06:57:19 UTC 2020


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

--- Comment #5 from Walter Bright <bugzilla at 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]   <== !!!!!

That last is certainly a problem; it should be rejected by the compiler. As for
the first instruction, I'm concerned about changing the behavior. Messing with
people's existing, working asm code is risky.

--


More information about the Digitalmars-d-bugs mailing list