Help with failing assert in dmd.backend.symbol.d

max haughton maxhaton at gmail.com
Fri Sep 2 18:02:22 UTC 2022


On Thursday, 1 September 2022 at 19:24:24 UTC, Teodor Dutu wrote:
> Hi,
>
> I have recently opened [this 
> PR](https://github.com/dlang/dmd/pull/14382) to change 
> `_d_arraysetassign` to a template. It has caused [this builkite 
> failure in 
> vibe-d](https://buildkite.com/dlang/dmd/builds/27898#0182f34a-7f4a-49f9-8b93-01e5ba42998b). I am able to reproduced it locally, but I am unable to debug it.
>
> Being a backend error, the `Symbol` struct doesn't seem to 
> store precise information about the line and file from where 
> that symbol comes. I have used `Symbol.lposscopestart`, but 
> that only tells where the symbol was created. In my case, it 
> was created here: `phobos/std/typecons.d(6822)`, but this 
> doesn't provide me with too much info.
>
> How would you debug this? Do you have any "tips" for debugging 
> the backend? I'd also like to build vibe-d without dub so I can 
> trace the compiler directly. How can I do this?
>
> Thanks for the help,
> Teodor

Try running gdb in follow fork mode, or run dub in verbose mode 
to get the dmd command.

The backends knowledge of where things come from is terrible.

For debugging the backend if it's not an obvious segfault or 
memory corruption etc you better get lucky with a printf or 
you're out of luck. It's an old and horrible codebase, the trees 
are simple enough but the algorithms were mostly designed before 
anything resembling modern compiler design practice.

Feel free to ramble on the d slack about what you've tried so far.


More information about the Digitalmars-d mailing list