[Issue 18373] New: The inline assembler parser allows strange constructs
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Feb 5 08:09:54 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18373
Issue ID: 18373
Summary: The inline assembler parser allows strange constructs
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: accepts-invalid, iasm
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: b2.temp at gmx.com
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.
--
More information about the Digitalmars-d-bugs
mailing list