dmd/ldc failed with exit code -11

Anonymouse asdf at asdf.net
Wed Nov 22 15:33:46 UTC 2017


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?


More information about the Digitalmars-d-learn mailing list