[Issue 19974] New: [Reg 2.086] changed naked asm parameter offsets (no more frame pointer assumed)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 16 11:11:25 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19974
Issue ID: 19974
Summary: [Reg 2.086] changed naked asm parameter offsets (no
more frame pointer assumed)
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: code at dawg.eu
cat > asm.d << CODE
extern (C++):
void too_many_symbols()
{
assert(0, "Failed");
}
int insidx(char *p,uint index)
{
asm
{
naked ;
mov EAX,index - [ESP+4] ;
mov ECX,p - [ESP+4] ;
cmp EAX,0x7F ;
jae L1 ;
mov [ECX],AL ;
mov EAX,1 ;
ret ;
L1: ;
cmp EAX,0x7FFF ;
ja L2 ;
mov [ECX+1],AL ;
or EAX,0x8000 ;
mov [ECX],AH ;
mov EAX,2 ;
ret ;
}
L2:
too_many_symbols();
}
extern(D) void main()
{
char[16] buf;
insidx(buf.ptr, 1);
assert(buf[0] == 1);
}
CODE
dmd.exe -m32 -run asm.d
Introduced by https://github.com/dlang/dmd/pull/9620
(0f66ef166fe6604754f20bc4424ad06c087df26e) on purpose. This change sets up
frame pointers only if necessary and thus affects the parameter offset
computation in naked asm functions.
2.085.1 works:
assume CS:?insidx@@YAHPADI at Z
L0: mov EAX,8[ESP]
mov ECX,4[ESP]
cmp EAX,07Fh
2.086.0 fails:
assume CS:?insidx@@YAHPADI at Z
L0: mov EAX,4[ESP]
mov ECX,[ESP]
cmp EAX,07Fh
--
More information about the Digitalmars-d-bugs
mailing list