Bug 15235 – inline asm: silent ICE (segfault) in asm_add_exp()

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2015-10-22T15:14:12Z
Last change time
2020-05-23T01:13:27Z
Keywords
diagnostic, iasm, pull
Assigned to
Cauterite
Creator
Cauterite

Comments

Comment #0 by cauterite — 2015-10-22T15:14:12Z
See: http://dpaste.dzfl.pl/701f26f64385 (in case dpaste is offline:) This statement: asm {mov [EBP - (0 - 0)], EAX;}; crashes DMD with no error message. The crash is an access violation in asm_add_exp(): Line 3953: o2 = asm_mul_exp(); // o2 is now null Line 3960: o2->disp = - o2->disp; // segfault
Comment #1 by cauterite — 2015-10-28T14:37:50Z
After some more thorough testing: void main() { asm { mov [+], EAX; // syntax error mov [-], EAX; // syntax error mov [*], EAX; // segfault mov [****], EAX; // segfault mov [/], EAX; // syntax error mov [EBX+], EAX; // compiles (?!) mov [EBX-], EAX; // segfault mov [EBX+*], EAX; // segfault mov [EBX*], EAX; // segfault mov [EBX*EBX*], EAX; // segfault mov [*EBX], EAX; // segfault mov [/EBX], EAX; // syntax error mov [EBX+EBX+EBX], EAX; // prints the same error message 20 times }; };
Comment #2 by cauterite — 2015-10-31T11:26:20Z
Comment #3 by cauterite — 2016-08-19T21:53:37Z
Previous pull request closed; this will now be fixed by the patch for issue 15257: https://github.com/dlang/dmd/pull/6068
Comment #4 by b2.temp — 2019-02-28T18:08:49Z
Downgraded to diagnostic. Nowadays just void main() { asm { mov [EBX+EBX+EBX], EAX; // prints the same error message 20 times } } is still there and all the segfaults are not happening anymore
Comment #5 by dlang-bot — 2020-05-19T22:49:26Z
@benjones created dlang/dmd pull request #11166 "Fix issue 15235" fixing this issue: - fix issue 15235. Return after spotting an asm syntax error rather than goto-ing it 10 times https://github.com/dlang/dmd/pull/11166
Comment #6 by dlang-bot — 2020-05-23T01:13:27Z
dlang/dmd pull request #11166 "Fix issue 15235: inline asm: silent ICE (segfault) in asm_add_exp()" was merged into master: - 185fd7155ea1dc7b22ed4b995ae12208d86f62e1 by Ben Jones: fix issue 15235. Return after spotting an asm syntax error rather than goto-ing it 10 times https://github.com/dlang/dmd/pull/11166