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
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 }; };
https://github.com/D-Programming-Language/dmd/pull/5248
Previous pull request closed; this will now be fixed by the patch for issue 15257: https://github.com/dlang/dmd/pull/6068
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
@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
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