Bug 18713 – ICE in dmd/statementsem.d:1798 with -dip1000

Status
RESOLVED
Resolution
WORKSFORME
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-04-03T07:09:35Z
Last change time
2020-03-21T03:56:33Z
Keywords
ice, ice-on-valid-code
Assigned to
No Owner
Creator
Seb

Comments

Comment #0 by greensunny12 — 2018-04-03T07:09:35Z
Observed here: https://github.com/dlang/phobos/pull/4990 Reduced sample: (Compile with -dip1000) --- ParallelForeach!R parallel(R)(R) { } void main() { auto arrIndex = new int; parallel(arrIndex).each!(i => e); } struct ParallelForeach(R) { alias E = R; alias IndexDg = int delegate(E); int opApply(IndexDg) { } } template each(alias pred) { enum isForeachUnaryIterable(R)(R r) { foreach (a; r) unaryFun; }; enum isForeachIterable(R) = isForeachUnaryIterable!R; void each(Range)(Range) if (isForeachIterable!Range) { } void each() { } } --- --- 0x00005555558ca61f in StatementSemanticVisitor::visit(ForeachStatement*) (this=0x7fffffff6bf8, fs=0x7fffee4d38b0) at dmd/statementsem.d:1798 1798 ++flde.fd.tookAddressOf; // allocate a closure unless the opApply() uses 'scope' #0 0x00005555558ca61f in StatementSemanticVisitor::visit(ForeachStatement*) (this=0x7fffffff6bf8, fs=0x7fffee4d38b0) at dmd/statementsem.d:1798 #1 0x00005555558a9522 in ForeachStatement::accept(Visitor*) (this=0x7fffee4d38b0, v=0x7fffffff6bf8) at dmd/statement.d:1301 #2 0x00005555558c5923 in statementSemantic(Statement*, Scope*) (s=0x7fffee4d38b0, sc=0x7fffee4c7750) at dmd/statementsem.d:127 #3 0x00005555558c5ce8 in StatementSemanticVisitor::visit(CompoundStatement*) (this=0x7fffffff6ef8, cs=0x7fffee4d3cf0) at dmd/statementsem.d:236 #4 0x00005555558a88de in CompoundStatement::accept(Visitor*) (this=0x7fffee4d3cf0, v=0x7fffffff6ef8) at dmd/statement.d:908 #5 0x00005555558c5923 in statementSemantic(Statement*, Scope*) (s=0x7fffee4d3cf0, sc=0x7fffee4c7750) at dmd/statementsem.d:127 #6 0x00005555558da7c0 in Semantic3Visitor::visit(FuncDeclaration*) (this=0x7fffffff7870, funcdecl=0x7fffee4d3460) at dmd/semantic3.d:581 #7 0x00005555558be8ea in ParseTimeVisitor<ASTCodegen>::visit(FuncLiteralDeclaration*) (this=0x7fffffff7870, s=0x7fffee4d3460) at dmd/parsetimevisitor.d:51 #8 0x000055555583e0ae in FuncLiteralDeclaration::accept(Visitor*) (this=0x7fffee4d3460, v=0x7fffffff7870) at dmd/func.d:3144 #9 0x00005555558d90b1 in semantic3(Dsymbol*, Scope*) (dsym=0x7fffee4d3460, sc=0x7fffee4ab060) at dmd/semantic3.d:83 #10 0x000055555582096b in ExpressionSemanticVisitor::visit(FuncExp*) (this=0x7fffffff79b8, exp=0x7fffee4d3420) at dmd/expressionsem.d:2610 #11 0x00005555558129ce in FuncExp::accept(Visitor*) (this=0x7fffee4d3420, v=0x7fffffff79b8) at dmd/expression.d:4656 #12 0x0000555555834f4f in expressionSemantic(Expression*, Scope*) (e=0x7fffee4d3420, sc=0x7fffee4a3650) at dmd/expressionsem.d:9367 #13 0x00005555558b2e4b in ResolveVisitor::visit(TypeTypeof*) (this=0x7fffffff7ac0, mt=0x7fffee4d3360) at dmd/typesem.d:2369 #14 0x000055555588302a in TypeTypeof::accept(Visitor*) (this=0x7fffee4d3360, v=0x7fffffff7ac0) at dmd/mtype.d:5785 #15 0x00005555558b22a5 in resolve(Type*, Loc const&, Scope*, Expression**, Type**, Dsymbol**, bool) (mt=0x7fffee4d3360, loc=..., sc=0x7fffee49bea0, pe=0x7fffffff7b58, pt=0x7fffffff7b60, ps=0x7fffffff7b68, intypeid=false) at dmd/typesem.d:2075 #16 0x00005555558b07c0 in TypeSemanticVisitor::visit(TypeTypeof*) (this=0x7fffffff7bd0, mtype=0x7fffee4d3360) at dmd/typesem.d:1299 #17 0x000055555588302a in TypeTypeof::accept(Visitor*) (this=0x7fffee4d3360, v=0x7fffffff7bd0) at dmd/mtype.d:5785 #18 0x00005555558ad393 in typeSemantic(Type*, Loc, Scope*) (t=0x7fffee4d3360, loc=..., sc=0x7fffee49bea0) at dmd/typesem.d:147 #19 0x000055555587931b in Type::trySemantic(Loc const&, Scope*) (this=0x7fffee4d3360, loc=..., sc=0x7fffee49bea0) at dmd/mtype.d:947 #20 0x0000555555824eaa in ExpressionSemanticVisitor::visit(IsExp*) (this=0x7fffffff7ec8, e=0x7fffee4d3300) at dmd/expressionsem.d:3823 #21 0x0000555555812e62 in IsExp::accept(Visitor*) (this=0x7fffee4d3300, v=0x7fffffff7ec8) at dmd/expression.d:4802 #22 0x0000555555834f4f in expressionSemantic(Expression*, Scope*) (e=0x7fffee4d3300, sc=0x7fffee49b600) at dmd/expressionsem.d:9367 #23 0x0000555555852241 in InferTypeVisitor::visit(ExpInitializer*) (this=0x7fffffff8008, init=0x7fffee4d32d0) at dmd/initsem.d:658 #24 0x000055555584fa62 in ExpInitializer::accept(Visitor*) (this=0x7fffee4d32d0, v=0x7fffffff8008) at dmd/init.d:322 #25 0x000055555584fd24 in inferType(Initializer*, Scope*) (init=0x7fffee4d32d0, sc=0x7fffee49b600) at dmd/initsem.d:51 #26 0x00005555557e135a in DsymbolSemanticVisitor::visit(VarDeclaration*) (this=0x7fffffff86b0, dsym=0x7fffee4d31b0) at dmd/dsymbolsem.d:583 #27 0x00005555557b275a in VarDeclaration::accept(Visitor*) (this=0x7fffee4d31b0, v=0x7fffffff86b0) at dmd/declaration.d:1612 #28 0x00005555557e09e1 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7fffee4d31b0, sc=0x7fffee484750) at dmd/dsymbolsem.d:343 #29 0x0000555555802dfc in TemplateInstance::expandMembers(Scope*) (this=0x7fffee4494b0, sc2=0x7fffee484750) at dmd/dtemplate.d:7487 #30 0x0000555555802e73 in TemplateInstance::tryExpandMembers(Scope*) (this=0x7fffee4494b0, sc2=0x7fffee484750) at dmd/dtemplate.d:7505 #31 0x00005555557f0247 in _D3dmd10dsymbolsem24templateInstanceSemanticFCQBs9dtemplate16TemplateInstancePSQCz6dscope5ScopePSQDr4root5array__T5ArrayTCQEq10expression10ExpressionZQBkZv (fargs=0x0, sc=0x7fffee449890, tempinst=0x7fffee4494b0) at dmd/dsymbolsem.d:5500 #32 0x00005555557e75ab in DsymbolSemanticVisitor::visit(TemplateInstance*) (this=0x7fffffff8aa0, ti=0x7fffee4494b0) at dmd/dsymbolsem.d:2474 #33 0x0000555555802f2e in TemplateInstance::accept(Visitor*) (this=0x7fffee4494b0, v=0x7fffffff8aa0) at dmd/dtemplate.d:7534 #34 0x00005555557e09e1 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7fffee4494b0, sc=0x7fffee449890) at dmd/dsymbolsem.d:343 #35 0x000055555581e667 in ExpressionSemanticVisitor::visit(ScopeExp*) (this=0x7fffffff8c88, exp=0x7fffee449480) at dmd/expressionsem.d:1926 #36 0x00005555558112ee in ScopeExp::accept(Visitor*) (this=0x7fffee449480, v=0x7fffffff8c88) at dmd/expression.d:4067 #37 0x0000555555834f4f in expressionSemantic(Expression*, Scope*) (e=0x7fffee449480, sc=0x7fffee449890) at dmd/expressionsem.d:9367 #38 0x0000555555832e7a in ExpressionSemanticVisitor::visit(LogicalExp*) (this=0x7fffffff8d68, exp=0x555557814db0) at dmd/expressionsem.d:8652 #39 0x00005555558174c6 in LogicalExp::accept(Visitor*) (this=0x555557814db0, v=0x7fffffff8d68) at dmd/expression.d:6913 #40 0x0000555555834f4f in expressionSemantic(Expression*, Scope*) (e=0x555557814db0, sc=0x7fffee449890) at dmd/expressionsem.d:9367 #41 0x0000555555832e7a in ExpressionSemanticVisitor::visit(LogicalExp*) (this=0x7fffffff8e48, exp=0x555557814cd0) at dmd/expressionsem.d:8652 #42 0x00005555558174c6 in LogicalExp::accept(Visitor*) (this=0x555557814cd0, v=0x7fffffff8e48) at dmd/expression.d:6913 #43 0x0000555555834f4f in expressionSemantic(Expression*, Scope*) (e=0x555557814cd0, sc=0x7fffee449890) at dmd/expressionsem.d:9367 #44 0x0000555555852241 in InferTypeVisitor::visit(ExpInitializer*) (this=0x7fffffff8f88, init=0x7fffee448a90) at dmd/initsem.d:658 #45 0x000055555584fa62 in ExpInitializer::accept(Visitor*) (this=0x7fffee448a90, v=0x7fffffff8f88) at dmd/init.d:322 #46 0x000055555584fd24 in inferType(Initializer*, Scope*) (init=0x7fffee448a90, sc=0x7fffee449890) at dmd/initsem.d:51 #47 0x00005555557e135a in DsymbolSemanticVisitor::visit(VarDeclaration*) (this=0x7fffffff9630, dsym=0x7fffee448970) at dmd/dsymbolsem.d:583 #48 0x00005555557b275a in VarDeclaration::accept(Visitor*) (this=0x7fffee448970, v=0x7fffffff9630) at dmd/declaration.d:1612 #49 0x00005555557e09e1 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7fffee448970, sc=0x7fffee447f40) at dmd/dsymbolsem.d:343 #50 0x0000555555802dfc in TemplateInstance::expandMembers(Scope*) (this=0x7fffee4481b0, sc2=0x7fffee447f40) at dmd/dtemplate.d:7487 #51 0x0000555555802e73 in TemplateInstance::tryExpandMembers(Scope*) (this=0x7fffee4481b0, sc2=0x7fffee447f40) at dmd/dtemplate.d:7505 #52 0x00005555557f0247 in _D3dmd10dsymbolsem24templateInstanceSemanticFCQBs9dtemplate16TemplateInstancePSQCz6dscope5ScopePSQDr4root5array__T5ArrayTCQEq10expression10ExpressionZQBkZv (fargs=0x0, sc=0x7fffee4474c0, tempinst=0x7fffee4481b0) at dmd/dsymbolsem.d:5500 #53 0x00005555557e75ab in DsymbolSemanticVisitor::visit(TemplateInstance*) (this=0x7fffffff9a20, ti=0x7fffee4481b0) at dmd/dsymbolsem.d:2474 #54 0x0000555555802f2e in TemplateInstance::accept(Visitor*) (this=0x7fffee4481b0, v=0x7fffffff9a20) at dmd/dtemplate.d:7534 #55 0x00005555557e09e1 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7fffee4481b0, sc=0x7fffee4474c0) at dmd/dsymbolsem.d:343 #56 0x000055555581e667 in ExpressionSemanticVisitor::visit(ScopeExp*) (this=0x7fffffff9c08, exp=0x7fffee448180) at dmd/expressionsem.d:1926 #57 0x00005555558112ee in ScopeExp::accept(Visitor*) (this=0x7fffee448180, v=0x7fffffff9c08) at dmd/expression.d:4067 #58 0x0000555555834f4f in expressionSemantic(Expression*, Scope*) (e=0x7fffee448180, sc=0x7fffee4474c0) at dmd/expressionsem.d:9367 #59 0x0000555555834d89 in _D3dmd13expressionsem11unaSemanticFCQBi10expression6UnaExpPSQCg6dscope5ScopeZCQCyQBq10Expression (sc=0x7fffee4474c0, e=0x5555578143e0) at dmd/expressionsem.d:9313 #60 0x0000555555828bf3 in ExpressionSemanticVisitor::visit(NotExp*) (this=0x7fffffff9d08, e=0x5555578143e0) at dmd/expressionsem.d:5097 #61 0x00005555558151ee in NotExp::accept(Visitor*) (this=0x5555578143e0, v=0x7fffffff9d08) at dmd/expression.d:5781 #62 0x0000555555834f4f in expressionSemantic(Expression*, Scope*) (e=0x5555578143e0, sc=0x7fffee4474c0) at dmd/expressionsem.d:9367 #63 0x00005555558d6084 in _D3dmd10staticcond19evalStaticConditionFPSQBo6dscope5ScopeCQCf10expression10ExpressionQBcKbZb (errors=@0x7fffffff9f28: false, e=0x5555578143e0, exp=0x555557812d40, sc=0x7fffee4474c0) at dmd/staticcond.d:82 #64 0x00005555558d5f46 in _D3dmd10staticcond19evalStaticConditionFPSQBo6dscope5ScopeCQCf10expression10ExpressionQBcKbZb (errors=@0x7fffffff9f28: false, e=0x555557814b40, exp=0x555557812d40, sc=0x7fffee4473b0) at dmd/staticcond.d:49 #65 0x00005555557f292e in TemplateDeclaration::evaluateConstraint(TemplateInstance*, Scope*, Scope*, Array<RootObject*>*, FuncDeclaration*) (this=0x7fffee43f3e0, ti=0x7fffee447720, sc=0x7fffee5ca260, paramscope=0x7fffee447110, dedargs=0x7fffee447880, fd=0x7fffee447b00) at dmd/dtemplate.d:778 #66 0x00005555557f58c3 in TemplateDeclaration::deduceFunctionTemplateMatch(TemplateInstance*, Scope*, FuncDeclaration*&, Type*, Array<Expression*>*) (this=0x7fffee43f3e0, ti=0x7fffee447720, sc=0x7fffee5ca260, fd=@0x7fffffffa7f0: 0x7fffee447b00, tthis=0x0, fargs=0x7fffee6398e0) at dmd/dtemplate.d:1982 #67 0x00005555557f78c4 in _D3dmd9dtemplate15functionResolveFPSQBi11declaration5MatchCQCf7dsymbol7DsymbolSQCz7globals3LocPSQDq6dscope5ScopePSQEi4root5array__T5ArrayTCQFhQz10rootobject10RootObjectZQBmCQGp5mtype4TypePSQHfQCxQCv__TQCsTCQHw10expression10ExpressionZQDzPPxaZ13applyTemplateMFCQJyQJx19TemplateDeclarationZi (this=0x7fffffffa9e0, td=0x7fffee43f3e0) at dmd/dtemplate.d:2690 #68 0x00005555557f7d7c in _D3dmd9dtemplate15functionResolveFPSQBi11declaration5MatchCQCf7dsymbol7DsymbolSQCz7globals3LocPSQDq6dscope5ScopePSQEi4root5array__T5ArrayTCQFhQz10rootobject10RootObjectZQBmCQGp5mtype4TypePSQHfQCxQCv__TQCsTCQHw10expression10ExpressionZQDzPPxaZ10__lambda11MFQHqZi (this=0x7fffffffa9e0, s=0x7fffee43f3e0) at dmd/dtemplate.d:2797 #69 0x000055555583c564 in _D3dmd4func13overloadApplyFCQBa7dsymbol7DsymbolMDFQxZiPSQCc6dscope5ScopeZi (sc=0x7fffee5ca260, dg=..., fstart=0x7fffee43f3e0) at dmd/func.d:2414 #70 0x00005555557f669d in _D3dmd9dtemplate15functionResolveFPSQBi11declaration5MatchCQCf7dsymbol7DsymbolSQCz7globals3LocPSQDq6dscope5ScopePSQEi4root5array__T5ArrayTCQFhQz10rootobject10RootObjectZQBmCQGp5mtype4TypePSQHfQCxQCv__TQCsTCQHw10expression10ExpressionZQDzPPxaZv (pMessage=0x7fffffffaa40, fargs=0x7fffee6398e0, tthis=0x0, tiargs=0x0, sc=0x7fffee5ca260, loc=..., dstart=0x7fffee43f3e0, m=0x7fffffffaa20) at dmd/dtemplate.d:2799 #71 0x000055555583c92f in resolveFuncCall(Loc const&, Scope*, Dsymbol*, Array<RootObject*>*, Type*, Array<Expression*>*, int) (loc=..., sc=0x7fffee5ca260, s=0x7fffee43f3e0, tiargs=0x0, tthis=0x0, fargs=0x7fffee6398e0, flags=0) at dmd/func.d:2575 #72 0x00005555558235fa in ExpressionSemanticVisitor::visit(CallExp*) (this=0x7fffffffb608, exp=0x7fffee639900) at dmd/expressionsem.d:3414 #73 0x0000555555814d62 in CallExp::accept(Visitor*) (this=0x7fffee639900, v=0x7fffffffb608) at dmd/expression.d:5612 #74 0x0000555555834f4f in expressionSemantic(Expression*, Scope*) (e=0x7fffee639900, sc=0x7fffee5ca260) at dmd/expressionsem.d:9367 #75 0x000055555580a562 in resolveUFCSProperties(Scope*, Expression*, Expression*) (sc=0x7fffee5ca260, e1=0x7ffff7f4a930, e2=0x0) at dmd/expression.d:921 #76 0x000055555582743e in ExpressionSemanticVisitor::visit(DotTemplateInstanceExp*) (this=0x7fffffffb7c8, exp=0x7ffff7f4a930) at dmd/expressionsem.d:4591 #77 0x0000555555814682 in DotTemplateInstanceExp::accept(Visitor*) (this=0x7ffff7f4a930, v=0x7fffffffb7c8) at dmd/expression.d:5426 #78 0x0000555555834f4f in expressionSemantic(Expression*, Scope*) (e=0x7ffff7f4a930, sc=0x7fffee5ca260) at dmd/expressionsem.d:9367 #79 0x00005555558c5a3a in StatementSemanticVisitor::visit(ExpStatement*) (this=0x7fffffffb898, s=0x7ffff7f4aad0) at dmd/statementsem.d:178 #80 0x00005555558a812a in ExpStatement::accept(Visitor*) (this=0x7ffff7f4aad0, v=0x7fffffffb898) at dmd/statement.d:715 #81 0x00005555558c5923 in statementSemantic(Statement*, Scope*) (s=0x7ffff7f4aad0, sc=0x7fffee5ca260) at dmd/statementsem.d:127 #82 0x00005555558c5ce8 in StatementSemanticVisitor::visit(CompoundStatement*) (this=0x7fffffffbb98, cs=0x7ffff7f4bc70) at dmd/statementsem.d:236 #83 0x00005555558a88de in CompoundStatement::accept(Visitor*) (this=0x7ffff7f4bc70, v=0x7fffffffbb98) at dmd/statement.d:908 #84 0x00005555558c5923 in statementSemantic(Statement*, Scope*) (s=0x7ffff7f4bc70, sc=0x7fffee5ca260) at dmd/statementsem.d:127 #85 0x00005555558da7c0 in Semantic3Visitor::visit(FuncDeclaration*) (this=0x7fffffffc510, funcdecl=0x7ffff7f4bc90) at dmd/semantic3.d:581 #86 0x00005555558be99e in ParseTimeVisitor<ASTCodegen>::visit(UnitTestDeclaration*) (this=0x7fffffffc510, s=0x7ffff7f4bc90) at dmd/parsetimevisitor.d:56 #87 0x000055555583ee2e in UnitTestDeclaration::accept(Visitor*) (this=0x7ffff7f4bc90, v=0x7fffffffc510) at dmd/func.d:3585 #88 0x00005555558d90b1 in semantic3(Dsymbol*, Scope*) (dsym=0x7ffff7f4bc90, sc=0x7ffff4a5fa70) at dmd/semantic3.d:83 #89 0x00005555558d94a8 in Semantic3Visitor::visit(Module*) (this=0x7fffffffc5c0, mod=0x7ffff7e9eb80) at dmd/semantic3.d:196 #90 0x00005555557d056e in Module::accept(Visitor*) (this=0x7ffff7e9eb80, v=0x7fffffffc5c0) at dmd/dmodule.d:1322 #91 0x00005555558d90b1 in semantic3(Dsymbol*, Scope*) (dsym=0x7ffff7e9eb80, sc=0x0) at dmd/semantic3.d:83 #92 0x000055555587301b in dmd.mars.tryMain(ulong, const(char)**) (argv=0x7fffffffd4c8, argc=22) at dmd/mars.d:836 #93 0x000055555587419f in D main () at dmd/mars.d:1098 ---
Comment #1 by b2.temp — 2019-06-10T08:51:04Z
latest release or stable DMD don't crash anymore and instead they issue standard front-end errors