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.
Comment #1 by dlang-bot — 2022-05-21T00:42:06Z
@maxhaton created dlang/dmd pull request #14152 "Fix Issues 23130, 19528 : Inline asm was too liberal about operand si…" fixing this issue:
- Fix Issues 23130, 19528 : Inline asm was too liberal about operand sizes.
A 8-byte type was only considered 8 bytes in 64 bit code, for some reason.
This led to inconsistent compilation of extended asm.
I tried to add an error message suggesting the use of an instruction like movsx
but this code is spaghetti.
https://github.com/dlang/dmd/pull/14152
Comment #2 by robert.schadek — 2024-12-13T19:23:01Z