www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14699] New: dmd 2.67 segfaults on innocent code

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

          Issue ID: 14699
           Summary: dmd 2.67 segfaults on innocent code
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: tomerfiliba gmail.com

The code crashes both dmd2.66 and 2.67

struct Table(K, V, ushort capacity_) {
    V[capacity_] values;
}

struct Set(K, ushort capacity_) {
    Table!(K, ubyte[0], capacity_) tbl;
}

// this works
Table!(uint, ubyte[0], 10) thisWorks;

// this crashes
Set!(uint, 10) thisCrashesDmd;

void main() {}

The segfault:
Program received signal SIGSEGV, Segmentation fault.
0x00000000005639c0 in dtcat(dt_t**, dt_t*) ()
(gdb) bt
#0  0x00000000005639c0 in dtcat(dt_t**, dt_t*) ()
#1  0x0000000000550157 in Expression_toDt(Expression*,
dt_t**)::ExpToDt::visit(ArrayLiteralExp*) ()
#2  0x00000000005500d8 in Expression_toDt(Expression*,
dt_t**)::ExpToDt::visit(ArrayLiteralExp*) ()
#3  0x0000000000550910 in toDtElem(TypeSArray*, dt_t**, Expression*) ()
#4  0x0000000000550d6c in Expression_toDt(Expression*,
dt_t**)::ExpToDt::visit(StructLiteralExp*) ()
#5  0x0000000000550c73 in Expression_toDt(Expression*,
dt_t**)::ExpToDt::visit(StructLiteralExp*) ()
#6  0x00000000005506a7 in StructDeclaration_toDt(StructDeclaration*, dt_t**) ()
#7  0x000000000055086d in Type_toDt(Type*, dt_t**) ()
#8  0x0000000000543595 in toObjFile(Dsymbol*,
bool)::ToObjFile::visit(VarDeclaration*) ()
#9  0x000000000054504d in toObjFile(Dsymbol*, bool) ()
#10 0x000000000052c974 in genObjFile(Module*, bool) ()
#11 0x0000000000405bf2 in tryMain(unsigned long, char const**) ()

--
Jun 14 2015