dmd/ldc failed with exit code -11

Petar Petar
Wed Nov 22 15:47:51 UTC 2017


On Wednesday, 22 November 2017 at 15:33:46 UTC, Anonymouse wrote:
> On Tuesday, 21 November 2017 at 19:22:47 UTC, Anonymouse wrote:
>> Compiling a debug dmd and running the build command in gdb, it 
>> seems to be a stack overflow at ddmd/dtemplate.d:6241, 
>> TemplateInstance::needsCodegen().
>
> After a lot of trial and error I managed to find /a/ line which 
> lets it compile under -b plain and release.
>
> void colour(Sink, Codes...)(auto ref Sink sink, const Codes 
> codes)
> {
>     // Sink is a LockingTextWriter or an Appender!string
>     // Codes is a tuple of named enum members
>
>     foreach (const code; codes)
>     {
>         import std.conv : to;
>
>         if (++numCodes > 1) sink.put(';');
>
>         sink.put((cast(size_t)code).to!string);  // <--
>     }
>
> Change size_t to uint and it compiles, keep it size_t and the 
> compiler segfaults. Tested on two machines, both running 
> up-to-date Arch linux, both with dmd and ldc.
>
> The bug is too ephemeral to reduce well, if a thing like order 
> of arguments matters.
>
> If this is an emergent property of the rest of the program, and 
> the size_t merely fells the house of cards, is it even worth 
> reporting when I can't reduce it?

You did a good investigation and I still think it's important to 
report it.

I managed to find a few other cases where people were having 
issues with needsCodegen:

https://github.com/ldc-developers/ldc/issues/2168#issuecomment-312709632
https://github.com/ldc-developers/ldc/issues/2336
https://github.com/ldc-developers/ldc/issues/2022#issuecomment-288481397
https://github.com/ldc-developers/ldc/issues/1297#issuecomment-184770787

So there's enough evidence that there's a bug somewhere around 
that part of the compiler and we should gather good test cases to 
narrow down the problem.


More information about the Digitalmars-d-learn mailing list