www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17949] New: ICE in dmangle.d

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

          Issue ID: 17949
           Summary: ICE in dmangle.d
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: john.loughran.colvin gmail.com

Dustmite and manual reduction of the same assert in a large codebase.

% cat break.d
auto foo()
{
        int high;
        auto window = S();
        window.map!(bs => bs.map!(bar => high));
}

struct S
{
        auto front()
        {
                return [3];
        }
}

template ElementType(R)
{
        static if (is(typeof(R.front.init) T))
                alias ElementType = T;
}

template map(alias fun)
{
        void map(Range)(Range)
        {
                alias RE = ElementType!Range;
                assert(!is(typeof(fun(RE.init))));
                MapResult!(fun, Range)();
        }
}

int front(int[] a);

struct MapResult(alias fun, Range)
{
        Range _input;

        void front()
        {
                fun(_input.front);
        }
}

% dmd -o- break.d
DMD v2.077.0-rc.1-68-g0342fe8c7 DEBUG
core.exception.AssertError ddmd/dmangle.d(374): Assertion failure
----------------
4   dmd                                 0x0000000100950e91 _d_assertp + 117
5   dmd                                 0x000000010074512e
_ZN7Mangler14mangleFuncTypeEP12TypeFunctionS1_hP4Type + 230
6   dmd                                 0x00000001007457a0
_ZN7Mangler10mangleFuncEP15FuncDeclarationb + 120
7   dmd                                 0x0000000100745703
_ZN7Mangler12mangleParentEP7Dsymbol + 267
8   dmd                                 0x000000010074656c
_ZN7Mangler5visitEP7Dsymbol + 28
9   dmd                                 0x000000010083b639
_ZN7Visitor5visitEP12ScopeDsymbol + 33
10  dmd                                 0x000000010083b661
_ZN7Visitor5visitEP19TemplateDeclaration + 33
11  dmd                                 0x0000000100774d01
_ZN19TemplateDeclaration6acceptEP7Visitor + 33
12  dmd                                 0x0000000100744d61
_ZN7Mangler12mangleSymbolEP7Dsymbol + 33
13  dmd                                 0x00000001007464bb
_ZN7Mangler22mangleTemplateInstanceEP16TemplateInstance + 1275
14  dmd                                 0x00000001007456b6
_ZN7Mangler12mangleParentEP7Dsymbol + 190
15  dmd                                 0x000000010074656c
_ZN7Mangler5visitEP7Dsymbol + 28
16  dmd                                 0x0000000100745f29
_ZN7Mangler5visitEP20AggregateDeclaration + 281
17  dmd                                 0x000000010083b7f1
_ZN7Visitor5visitEP17StructDeclaration + 33
18  dmd                                 0x0000000100755191
_ZN17StructDeclaration6acceptEP7Visitor + 33
19  dmd                                 0x0000000100744d61
_ZN7Mangler12mangleSymbolEP7Dsymbol + 33
20  dmd                                 0x00000001007454a0
_ZN7Mangler5visitEP10TypeStruct + 48
21  dmd                                 0x00000001008038f9
_ZN10TypeStruct6acceptEP7Visitor + 33
22  dmd                                 0x0000000100744d9a
_ZN7Mangler10mangleTypeEP4Type + 50
23  dmd                                 0x0000000100744e34
_ZN7Mangler13visitWithMaskEP4Typeh + 68
24  dmd                                 0x0000000100747045
_ZN7Mangler5visitEP9Parameter + 349
25  dmd                                 0x0000000100807a91
_ZN9Parameter6acceptEP7Visitor + 33
26  dmd                                 0x0000000100746ee3 int
ddmd.dmangle.Mangler.paramsToDecoBuffer(ddmd.root.array.Array!(ddmd.mtype.Parameter).Array*).paramsToDecoBufferDg(ulong,
ddmd.mtype.Parameter) + 35
27  dmd                                 0x0000000100807da5 int
ddmd.mtype.Parameter._foreach(ddmd.root.array.Array!(ddmd.mtype.Parameter).Array*,
int delegate(ulong, ddmd.mtype.Parameter), ulong*) + 253
28  dmd                                 0x0000000100746ebd
_ZN7Mangler18paramsToDecoBufferEP5ArrayIP9ParameterE + 37
29  dmd                                 0x000000010074535d
_ZN7Mangler14mangleFuncTypeEP12TypeFunctionS1_hP4Type + 789
30  dmd                                 0x0000000100745044
_ZN7Mangler5visitEP12TypeFunction + 44
31  dmd                                 0x00000001007ff1e1
_ZN12TypeFunction6acceptEP7Visitor + 33
32  dmd                                 0x0000000100744d9a
_ZN7Mangler10mangleTypeEP4Type + 50
33  dmd                                 0x0000000100744e34
_ZN7Mangler13visitWithMaskEP4Typeh + 68
34  dmd                                 0x000000010074716e
_Z14mangleToBufferP4TypeP9OutBuffer + 102
35  dmd                                 0x000000010083574e ddmd.mtype.Type
ddmd.typesem.merge(ddmd.mtype.Type) + 286
36  dmd                                 0x0000000100834b08
_ZN19TypeSemanticVisitor5visitEP12TypeFunction + 5328
37  dmd                                 0x00000001007ff1e1
_ZN12TypeFunction6acceptEP7Visitor + 33
38  dmd                                 0x00000001008314f6
_Z12typeSemanticP4Type3LocP5Scope + 86
39  dmd                                 0x00000001007671df
_ZN22DsymbolSemanticVisitor23funcDeclarationSemanticEP15FuncDeclaration + 2711
40  dmd                                 0x0000000100768afc
_ZN22DsymbolSemanticVisitor5visitEP15FuncDeclaration + 28
41  dmd                                 0x00000001007bcd11
_ZN15FuncDeclaration6acceptEP7Visitor + 33
42  dmd                                 0x0000000100759b70
_Z15dsymbolSemanticP7DsymbolP5Scope + 64
43  dmd                                 0x0000000100700568
_Z14buildXopEqualsP17StructDeclarationP5Scope + 1512
44  dmd                                 0x000000010076ad4f
_ZN22DsymbolSemanticVisitor5visitEP17StructDeclaration + 1927
45  dmd                                 0x0000000100755191
_ZN17StructDeclaration6acceptEP7Visitor + 33
46  dmd                                 0x0000000100759b70
_Z15dsymbolSemanticP7DsymbolP5Scope + 64
47  dmd                                 0x0000000100781ae8
_ZN16TemplateInstance13expandMembersEP5Scope + 240
48  dmd                                 0x0000000100781b62
_ZN16TemplateInstance16tryExpandMembersEP5Scope + 98
49  dmd                                 0x000000010076ea6e void
ddmd.dsymbolsem.templateInstanceSemantic(ddmd.dtemplate.TemplateInstance,
ddmd.dscope.Scope*, ddmd.root.array.Array!(ddmd.expression.Expression).Array*)
+ 2422
50  dmd                                 0x0000000100765d2a
_ZN22DsymbolSemanticVisitor5visitEP16TemplateInstance + 34
51  dmd                                 0x0000000100781c29
_ZN16TemplateInstance6acceptEP7Visitor + 33
52  dmd                                 0x0000000100759b70
_Z15dsymbolSemanticP7DsymbolP5Scope + 64
53  dmd                                 0x000000010079db20
_ZN25ExpressionSemanticVisitor5visitEP8ScopeExp + 1264
54  dmd                                 0x000000010078fd61
_ZN8ScopeExp6acceptEP7Visitor + 33
55  dmd                                 0x00000001007b53fa
_Z18expressionSemanticP10ExpressionP5Scope + 66
56  dmd                                 0x000000010083e3c1
_ZN24StatementSemanticVisitor5visitEP12ExpStatement + 81
57  dmd                                 0x000000010082c15e
_ZN12ExpStatement6acceptEP7Visitor + 30
58  dmd                                 0x000000010083e2a2
_Z17statementSemanticP9StatementP5Scope + 66
59  dmd                                 0x000000010083e683
_ZN24StatementSemanticVisitor5visitEP17CompoundStatement + 251
60  dmd                                 0x000000010082c98e
_ZN17CompoundStatement6acceptEP7Visitor + 30
61  dmd                                 0x000000010083e2a2
_Z17statementSemanticP9StatementP5Scope + 66
62  dmd                                 0x000000010075c520
_ZN16Semantic3Visitor5visitEP15FuncDeclaration + 4960
63  dmd                                 0x00000001007bcd11
_ZN15FuncDeclaration6acceptEP7Visitor + 33
64  dmd                                 0x0000000100829fb0
_Z9semantic3P7DsymbolP5Scope + 64
65  dmd                                 0x000000010075af17
_ZN16Semantic3Visitor5visitEP16TemplateInstance + 359
66  dmd                                 0x0000000100781c29
_ZN16TemplateInstance6acceptEP7Visitor + 33
67  dmd                                 0x0000000100829fb0
_Z9semantic3P7DsymbolP5Scope + 64
68  dmd                                 0x0000000100781bda
_ZN16TemplateInstance12trySemantic3EP5Scope + 98
69  dmd                                 0x000000010076eedd void
ddmd.dsymbolsem.templateInstanceSemantic(ddmd.dtemplate.TemplateInstance,
ddmd.dscope.Scope*, ddmd.root.array.Array!(ddmd.expression.Expression).Array*)
+ 3557
70  dmd                                 0x00000001007750c8 void
ddmd.dtemplate.functionResolve(ddmd.declaration.Match*, ddmd.dsymbol.Dsymbol,
ddmd.globals.Loc, ddmd.dscope.Scope*,
ddmd.root.array.Array!(ddmd.root.rootobject.RootObject).Array*,
ddmd.mtype.Type, ddmd.root.array.Array!(ddmd.expression.Expression).Array*) +
376
71  dmd                                 0x00000001007bd4cc
_Z15resolveFuncCall3LocP5ScopeP7DsymbolP5ArrayIP10RootObjectEP4TypePS4_IP10ExpressionEi
+ 188
72  dmd                                 0x00000001007a305e
_ZN25ExpressionSemanticVisitor5visitEP7CallExp + 10718
73  dmd                                 0x0000000100793a79
_ZN7CallExp6acceptEP7Visitor + 33
74  dmd                                 0x00000001007b53fa
_Z18expressionSemanticP10ExpressionP5Scope + 66
75  dmd                                 0x0000000100788a94
_Z21resolveUFCSPropertiesP5ScopeP10ExpressionS2_ + 1044
76  dmd                                 0x00000001007a6fd1
_ZN25ExpressionSemanticVisitor5visitEP22DotTemplateInstanceExp + 65
77  dmd                                 0x0000000100793369
_ZN22DotTemplateInstanceExp6acceptEP7Visitor + 33
78  dmd                                 0x00000001007b53fa
_Z18expressionSemanticP10ExpressionP5Scope + 66
79  dmd                                 0x0000000100848235
_ZN24StatementSemanticVisitor5visitEP15ReturnStatement + 1397
80  dmd                                 0x000000010082eaf9
_ZN15ReturnStatement6acceptEP7Visitor + 33
81  dmd                                 0x000000010083e2a2
_Z17statementSemanticP9StatementP5Scope + 66
82  dmd                                 0x000000010075c520
_ZN16Semantic3Visitor5visitEP15FuncDeclaration + 4960
83  dmd                                 0x000000010083bca1
_ZN7Visitor5visitEP22FuncLiteralDeclaration + 33
84  dmd                                 0x00000001007bebf1
_ZN22FuncLiteralDeclaration6acceptEP7Visitor + 33
85  dmd                                 0x0000000100829fb0
_Z9semantic3P7DsymbolP5Scope + 64
86  dmd                                 0x000000010075af17
_ZN16Semantic3Visitor5visitEP16TemplateInstance + 359
87  dmd                                 0x0000000100781c29
_ZN16TemplateInstance6acceptEP7Visitor + 33
88  dmd                                 0x0000000100829fb0
_Z9semantic3P7DsymbolP5Scope + 64
89  dmd                                 0x0000000100781bda
_ZN16TemplateInstance12trySemantic3EP5Scope + 98
90  dmd                                 0x000000010076eedd void
ddmd.dsymbolsem.templateInstanceSemantic(ddmd.dtemplate.TemplateInstance,
ddmd.dscope.Scope*, ddmd.root.array.Array!(ddmd.expression.Expression).Array*)
+ 3557
91  dmd                                 0x00000001007750c8 void
ddmd.dtemplate.functionResolve(ddmd.declaration.Match*, ddmd.dsymbol.Dsymbol,
ddmd.globals.Loc, ddmd.dscope.Scope*,
ddmd.root.array.Array!(ddmd.root.rootobject.RootObject).Array*,
ddmd.mtype.Type, ddmd.root.array.Array!(ddmd.expression.Expression).Array*) +
376
92  dmd                                 0x00000001007bd4cc
_Z15resolveFuncCall3LocP5ScopeP7DsymbolP5ArrayIP10RootObjectEP4TypePS4_IP10ExpressionEi
+ 188
93  dmd                                 0x00000001007a305e
_ZN25ExpressionSemanticVisitor5visitEP7CallExp + 10718
94  dmd                                 0x0000000100793a79
_ZN7CallExp6acceptEP7Visitor + 33
95  dmd                                 0x00000001007b53fa
_Z18expressionSemanticP10ExpressionP5Scope + 66
96  dmd                                 0x000000010083e3c1
_ZN24StatementSemanticVisitor5visitEP12ExpStatement + 81
97  dmd                                 0x000000010082c15e
_ZN12ExpStatement6acceptEP7Visitor + 30
98  dmd                                 0x000000010083e2a2
_Z17statementSemanticP9StatementP5Scope + 66
99  dmd                                 0x000000010083e683
_ZN24StatementSemanticVisitor5visitEP17CompoundStatement + 251
100 dmd                                 0x000000010082c98e
_ZN17CompoundStatement6acceptEP7Visitor + 30
101 dmd                                 0x000000010083e2a2
_Z17statementSemanticP9StatementP5Scope + 66
102 dmd                                 0x000000010075c520
_ZN16Semantic3Visitor5visitEP15FuncDeclaration + 4960
103 dmd                                 0x00000001007bcd11
_ZN15FuncDeclaration6acceptEP7Visitor + 33
104 dmd                                 0x0000000100829fb0
_Z9semantic3P7DsymbolP5Scope + 64
105 dmd                                 0x000000010075f3e2
_ZN16Semantic3Visitor5visitEP20AggregateDeclaration + 210
106 dmd                                 0x000000010083b7f1
_ZN7Visitor5visitEP17StructDeclaration + 33
107 dmd                                 0x0000000100755191
_ZN17StructDeclaration6acceptEP7Visitor + 33
108 dmd                                 0x0000000100829fb0
_Z9semantic3P7DsymbolP5Scope + 64
109 dmd                                 0x000000010075af17
_ZN16Semantic3Visitor5visitEP16TemplateInstance + 359
110 dmd                                 0x0000000100781c29
_ZN16TemplateInstance6acceptEP7Visitor + 33
111 dmd                                 0x0000000100829fb0
_Z9semantic3P7DsymbolP5Scope + 64
112 dmd                                 0x0000000100781bda
_ZN16TemplateInstance12trySemantic3EP5Scope + 98
113 dmd                                 0x000000010076eedd void
ddmd.dsymbolsem.templateInstanceSemantic(ddmd.dtemplate.TemplateInstance,
ddmd.dscope.Scope*, ddmd.root.array.Array!(ddmd.expression.Expression).Array*)
+ 3557
114 dmd                                 0x0000000100765d2a
_ZN22DsymbolSemanticVisitor5visitEP16TemplateInstance + 34
115 dmd                                 0x0000000100781c29
_ZN16TemplateInstance6acceptEP7Visitor + 33
116 dmd                                 0x0000000100759b70
_Z15dsymbolSemanticP7DsymbolP5Scope + 64
117 dmd                                 0x000000010079db20
_ZN25ExpressionSemanticVisitor5visitEP8ScopeExp + 1264
118 dmd                                 0x000000010078fd61
_ZN8ScopeExp6acceptEP7Visitor + 33
119 dmd                                 0x00000001007b53fa
_Z18expressionSemanticP10ExpressionP5Scope + 66
120 dmd                                 0x000000010083e3c1
_ZN24StatementSemanticVisitor5visitEP12ExpStatement + 81
121 dmd                                 0x000000010082c15e
_ZN12ExpStatement6acceptEP7Visitor + 30
122 dmd                                 0x000000010083e2a2
_Z17statementSemanticP9StatementP5Scope + 66
123 dmd                                 0x000000010083e683
_ZN24StatementSemanticVisitor5visitEP17CompoundStatement + 251
124 dmd                                 0x000000010082c98e
_ZN17CompoundStatement6acceptEP7Visitor + 30
125 dmd                                 0x000000010083e2a2
_Z17statementSemanticP9StatementP5Scope + 66
126 dmd                                 0x000000010075c520
_ZN16Semantic3Visitor5visitEP15FuncDeclaration + 4960
127 dmd                                 0x00000001007bcd11
_ZN15FuncDeclaration6acceptEP7Visitor + 33

--
Oct 29 2017