Bug 19974 – [Reg 2.086] changed naked asm parameter offsets (no more frame pointer assumed)

Status
RESOLVED
Resolution
WONTFIX
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-06-16T11:11:25Z
Last change time
2019-06-16T12:16:44Z
Assigned to
No Owner
Creator
Martin Nowak

Comments

Comment #0 by code — 2019-06-16T11:11:25Z
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@Z L0: mov EAX,8[ESP] mov ECX,4[ESP] cmp EAX,07Fh 2.086.0 fails: assume CS:?insidx@@YAHPADI@Z L0: mov EAX,4[ESP] mov ECX,[ESP] cmp EAX,07Fh
Comment #1 by dlang-bot — 2019-06-16T11:22:06Z
@MartinNowak created dlang/dmd pull request #10045 "workaround Issue 19974 - changed naked asm parameter offsets" mentioning this issue: - workaround Issue 19974 - changed naked asm parameter offsets - fixes building dmd for Win32 with 2.086 host compiler (nightly and upcoming 2.087.0-beta.1) https://github.com/dlang/dmd/pull/10045
Comment #2 by code — 2019-06-16T11:23:53Z
Closing as WONTFIX as this was an intended codegen change.
Comment #3 by dlang-bot — 2019-06-16T12:16:44Z
dlang/dmd pull request #10045 "workaround Issue 19974 - changed naked asm parameter offsets" was merged into master: - 03f9886f6b1fe898c31a3a28c9b18d35b4da94a6 by Martin Nowak: workaround Issue 19974 - changed naked asm parameter offsets - fixes building dmd for Win32 with 2.086 host compiler (nightly and upcoming 2.087.0-beta.1) https://github.com/dlang/dmd/pull/10045