D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21181 - Inline Assmbler compiles long ptr as a byte operation for 32 bit compiles
Summary: Inline Assmbler compiles long ptr as a byte operation for 32 bit compiles
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 All
: P1 normal
Assignee: No Owner
URL:
Keywords: iasm, pull, wrong-code
Depends on:
Blocks:
 
Reported: 2020-08-21 07:43 UTC by Walter Bright
Modified: 2020-08-24 03:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2020-08-21 07:43:07 UTC
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.
Comment 1 Dlang Bot 2020-08-21 07:57:36 UTC
@WalterBright created dlang/dmd pull request #11601 "fix Issue 21181 - Inline Assembler compiles long ptr as a byte operati…" fixing this issue:

- fix Issue 21181 - Inline Assmbler compiles long ptr as a byte operation for 32 bit compiles

https://github.com/dlang/dmd/pull/11601
Comment 2 Dlang Bot 2020-08-24 03:16:09 UTC
dlang/dmd pull request #11601 "fix Issue 21181 - Inline Assembler compiles long ptr as a byte operati…" was merged into master:

- 4495f6f66dd36e3547c47a464f4393c26f7f4afc by Walter Bright:
  fix Issue 21181 - Inline Assmbler compiles long ptr as a byte operation for 32 bit compiles

https://github.com/dlang/dmd/pull/11601