www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19631] New: Segfault on simple nested templated struct using

https://issues.dlang.org/show_bug.cgi?id=19631

          Issue ID: 19631
           Summary: Segfault on simple nested templated struct using DMD64
                    D Compiler v2.084.0
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bestellung marschall-informatik.de

The code below causes DMD to segfault. (while gdc works fine)
I have tried different configurations (debug / release and more), but there
All tried with Ubuntu 18.04 64bit

import std.stdio;

/*
        dmd fails with exit code 139 on this. 

        dmd --version
        DMD64 D Compiler v2.084.0

        (gdc (Ubuntu 8.2.0-1ubuntu2~18.04) 8.2.0) builds and runs correct)
*/
struct Field(int _w, int _h)
{
        bool[_h][_w] s;
}

struct Life(int w, int h)
{
        //Two versions below both crash it
        //auto a = new Field!(w, h);
        Field!(w, h)* a = new Field!(w, h);

        //This would work - the nesting seems to trigger it
        //bool[h][w] a;
}

void main()
{
        Life!(100, 100) f1;
        //auto f2 = new Life!(128,128);
}

--
Jan 29