Any guides on debugging DMD crash?

Stefan Koch uplink.coder at gmail.com
Mon Mar 23 19:46:33 UTC 2020


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

Hi, so I've found out what's going on.

An assertion in CSE (Common Subexpression Elimination) fails.
Which means that this is indeed an optimizer bug in the backend.
I can not yet say how to fix it but is should be enough for you 
to file a bug report.

The steps I took to find this are the following
1. Compile dmd with debug symbols.
2. use dub -v to see the compile commandline which fails.
3. run the commandline under gdb. (gdb --args)
4. look at where the failure happens.


More information about the Digitalmars-d mailing list