Bug 18373 – The inline assembler parser allows strange constructs
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-02-05T08:09:54Z
Last change time
2020-08-28T09:40:42Z
Keywords
accepts-invalid, iasm, pull
Assigned to
No Owner
Creator
Basile-z
Comments
Comment #0 by b2.temp — 2018-02-05T08:09:54Z
Example 1/
void foo()
{
asm pure nothrow
{
naked;
mov RAX, [0x10][0x20] R8;
ret;
}
}
generates:
;------- SUB 0000000000449468h -------
0000000000449468h mov eax, 00000030h
000000000044946Dh ret
;-------------------------------------
Example 2/
void foo()
{
asm pure nothrow
{
naked;
mov RAX, [R9][R10] R8;
ret;
}
}
generates:
;------- SUB 0000000000449468h -------
0000000000449468h mov rax, r8
000000000044946Bh ret
;-------------------------------------
And the best for the end ;)
void foo()
{
asm pure nothrow
{
naked;
mov RAX[R8][R12], [0x10][0x20] DX [0x10][0x20];
ret;
}
}
generates:
;------- SUB 0000000000449468h -------
0000000000449468h mov eax, 00000060h
000000000044946Dh ret
;-------------------------------------
All of them should be detected as error, at some point.
Maybe after iasm parsing since recursive nature of the parser may allow this.
Comment #1 by dlang-bot — 2020-08-28T08:29:31Z
@WalterBright created dlang/dmd pull request #11637 "fix Issue 18373 - The inline assembler parser allows strange constructs" fixing this issue:
- fix Issue 18373 - The inline assembler parser allows strange constructs
https://github.com/dlang/dmd/pull/11637
Comment #2 by dlang-bot — 2020-08-28T09:40:42Z
dlang/dmd pull request #11637 "fix Issue 18373 - The inline assembler parser allows strange constructs" was merged into master:
- 0b0627e63a981a65b6bffc215d36d6faae16e2c3 by Walter Bright:
fix Issue 18373 - The inline assembler parser allows strange constructs
https://github.com/dlang/dmd/pull/11637