Any guides on debugging DMD crash?

Matt Jones matthew.brennan.jones at gmail.com
Wed Mar 25 05:39:54 UTC 2020


On Monday, 23 March 2020 at 00:17:48 UTC, Arine wrote:
> On Sunday, 22 March 2020 at 22:33:13 UTC, Matt Jones wrote:
>> Does anyone have a guide on how to debug DMD crashes? I've 
>> been getting compiler crashes on version 2.087.1 through 
>> 2.091.0 (only release mode on both Windows 10 and Linux). 
>> Version 2.086.1 was the last one that worked:
>>
>> dub run --arch=x86_64 --build=release
>>
>> C:\D\dmd2\windows\bin\dmd.exe failed with exit code 
>> -1073741795.
>>
>> Here is the smallest code snippet I could make crash: 
>> https://github.com/workhorsy/crash_dmd
>
> Since it crashes when you do a release build, this is most 
> likely a bug in the backend. DMD's backend is known to have a 
> lot of issues and they don't tend to be fixed as there's only a 
> few people that actually work on it. Even if someone outside of 
> the main D team fixes the bug, the fix won't get merged in for 
> release as those same individuals don't bother to review those 
> pull requests.
>
> You'll probably have better luck using LDC2, which has a tried 
> and proven backend LLVM. It doesn't compile as fast, but I find 
> the few seconds is worth the trade off of not having to deal 
> with as many compiler bugs like the one you've found here.
>
> https://github.com/ldc-developers/ldc#installation

I've been trying LDC2 every couple of years. It's been a while.

I just tried building a few D apps with LDC2. I managed to get 
things to compile in release mode. I noticed a few of my apps 
work differently when compiled in DMD and LDC2. I'll have to see 
why they run differently. A few 3rd party libraries I use failed 
with strange linking errors on LDC2.

I'll have to look more into this. Looks like LDC2 is more viable 
now than before.


More information about the Digitalmars-d mailing list