[Issue 19631] Segfault on simple nested templated struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 29 18:06:03 UTC 2019


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

--- Comment #2 from Basile-z <b2.temp at gmx.com> ---
Problem happens when the initializer type is being determined. 
In case of this issue is blocking some work there are two possible workarounds
in addition to the "non nesting" solution.

1. Field!(w, h) a = *new Field!(w, h);
2. bool[_h][_w] s = void;  


bt:
---
Program received signal SIGSEGV, Segmentation fault.
0x00000000006466a0 in Type::isImmutable() const (this=0x0) at dmd/mtype.d:1072
1072            return (mod & MODFlags.immutable_) != 0;
Missing separate debuginfos, use: dnf debuginfo-install
libgcc-8.2.1-6.fc28.x86_64
(gdb) bt
#0  0x00000000006466a0 in Type::isImmutable() const (this=0x0) at
dmd/mtype.d:1072
#1  0x0000000000646929 in Type::immutableOf() (this=0x0) at dmd/mtype.d:1167
#2  0x00000000006454ae in Type::equivalent(Type*) (this=0x7ffff6aac6c0, t=0x0)
at dmd/mtype.d:534
#3  0x00000000006b538e in
_D3dmd4todt8toDtElemFCQu5mtype10TypeSArrayKSQBq7backend2dt9DtBuilderCQCp10expression10ExpressionZv
(e=0x7ffff6aad4c0, dtb=..., 
    tsa=0x7ffff6aac5f0) at dmd/todt.d:868
#4  0x00000000006b508e in
_D3dmd4todt11membersToDtFCQy9aggregate20AggregateDeclarationKSQCi7backend2dt9DtBuilderPSQDi4root5array__T5ArrayTCQEh10expression10ExpressionZQBkmCQFo6dclass16ClassDeclarationPPPSQGuQBg9BaseClassZv
(ppb=0x0, concreteType=0x0, firstFieldIndex=0, elements=0x7ffff6aad580,
dtb=..., 
    ad=0x7ffff6aab7f0) at dmd/todt.d:792
#5  0x00000000006b43c9 in Expression_toDt::ExpToDt::visit(StructLiteralExp*)
(this=0x7fffffffcd18, sle=0x7ffff6aad5a0) at dmd/todt.d:469
#6  0x00000000005d358e in StructLiteralExp::accept(Visitor*)
(this=0x7ffff6aad5a0, v=0x7fffffffcd18) at dmd/expression.d:3103
#7  0x00000000006b3913 in Expression_toDt(Expression*, DtBuilder&)
(e=0x7ffff6aad5a0, dtb=...) at dmd/todt.d:585
#8  0x00000000006b87ae in toSymbol(StructLiteralExp*) (sle=0x7ffff6aad5a0) at
dmd/tocsym.d:677
#9  0x00000000006b3ae2 in Expression_toDt::ExpToDt::visit(AddrExp*)
(this=0x7fffffffce18, e=0xba5750) at dmd/todt.d:271
#10 0x00000000005d790e in AddrExp::accept(Visitor*) (this=0xba5750,
v=0x7fffffffce18) at dmd/expression.d:4892
#11 0x00000000006b3913 in Expression_toDt(Expression*, DtBuilder&) (e=0xba5750,
dtb=...) at dmd/todt.d:585
#12 0x00000000006b38c6 in
_D3dmd4todt16Initializer_toDtRCQBd4init11InitializerKSQCa7backend2dt9DtBuilderZ8visitExpMFCQDlQCi14ExpInitializerZv
(
    __capture=0x7fffffffcea0, ei=0x7ffff6aaa6a0) at dmd/todt.d:197
---Type <return> to continue, or q <return> to quit---
#13 0x00000000006b321c in Initializer_toDt(Initializer*, DtBuilder&)
(init=0x7ffff6aaa6a0, dtb=...) at dmd/todt.d:206
#14 0x00000000006b5148 in
_D3dmd4todt11membersToDtFCQy9aggregate20AggregateDeclarationKSQCi7backend2dt9DtBuilderPSQDi4root5array__T5ArrayTCQEh10expression10ExpressionZQBkmCQFo6dclass16ClassDeclarationPPPSQGuQBg9BaseClassZv
(ppb=0x0, concreteType=0x0, firstFieldIndex=0, elements=0x0, dtb=...,
ad=0x7ffff6aa9e00)
    at dmd/todt.d:811
#15 0x00000000006b48d7 in StructDeclaration_toDt(StructDeclaration*,
DtBuilder&) (sd=0x7ffff6aa9e00, dtb=...) at dmd/todt.d:604
#16 0x00000000006c01f0 in toObjFile::ToObjFile::visit(StructDeclaration*)
(this=0x7fffffffd1b8, sd=0x7ffff6aa9e00) at dmd/toobj.d:512
#17 0x000000000059d64a in StructDeclaration::accept(Visitor*)
(this=0x7ffff6aa9e00, v=0x7fffffffd1b8) at dmd/dstruct.d:592
#18 0x00000000006c0d41 in
_D3dmd5toobj9toObjFileRCQw7dsymbol7DsymbolbZ9ToObjFile5visitMRCQCj9dtemplate16TemplateInstanceZ__T9__lambda2TQDiZQpMFQDqZv
(
    __capture=0x7fffffffd160, s=0x7ffff6aa9e00) at dmd/toobj.d:836
#19 0x000000000059dbc4 in
_D3dmd7dsymbol14foreachDsymbolFPSQBf4root5array__T5ArrayTCQCeQCd7DsymbolZQxMDFQvZvZv
(dg=..., symbols=0x7ffff6aa9de0)
    at dmd/dsymbol.d:97
#20 0x00000000006c0d17 in toObjFile::ToObjFile::visit(TemplateInstance*)
(this=0x7fffffffd1b8, ti=0x7ffff6d46fe0) at dmd/toobj.d:836
#21 0x00000000005c70de in TemplateInstance::accept(Visitor*)
(this=0x7ffff6d46fe0, v=0x7fffffffd1b8) at dmd/dtemplate.d:7507
#22 0x00000000006bfa72 in toObjFile(Dsymbol*, bool) (ds=0x7ffff6d46fe0,
multiobj=false) at dmd/toobj.d:1020
#23 0x00000000006b0664 in genObjFile(Module*, bool) (m=0x7ffff6d44d80,
multiobj=false) at dmd/glue.d:409
#24 0x000000000063fb7c in _D3dmd4mars7tryMainFmPPxaKSQz7globals5ParamZi
(params=..., argv=0x7fffffffddc8, argc=2) at dmd/mars.d:705
#25 0x0000000000640759 in D main () at dmd/mars.d:858
---

--


More information about the Digitalmars-d-bugs mailing list