Bug 22122 – [REG 2.097][ICE] Segmentation fault in in dmd.access.hasPackageAccess

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-07-13T15:46:54Z
Last change time
2021-07-23T22:15:22Z
Keywords
industry, pull
Assigned to
No Owner
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2021-07-13T15:46:54Z
Program received signal SIGSEGV, Segmentation fault. 0x000055555586148e in dmd.access.hasPackageAccess(dmd.dmodule.Module, dmd.dsymbol.Dsymbol) (s=0x7ffff72c3f80, mod=0x0) at src/dmd/access.d:107 #0 0x000055555586148e in dmd.access.hasPackageAccess(dmd.dmodule.Module, dmd.dsymbol.Dsymbol) ( s=0x7ffff72c3f80, mod=0x0) at src/dmd/access.d:107 #1 0x0000555555861838 in dmd.access.symbolIsVisible(dmd.dmodule.Module, dmd.dsymbol.Dsymbol) ( s=0x7ffff72c5ca0, mod=0x0) at src/dmd/access.d:254 #2 0x00005555558618a9 in dmd.access.symbolIsVisible(dmd.dsymbol.Dsymbol, dmd.dsymbol.Dsymbol) ( s=0x7ffff72c5ca0, origin=0x7ffff72ec570) at src/dmd/access.d:265 #3 0x00005555558e2737 in ScopeDsymbol::search(Loc const&, Identifier*, int) (this=0x7ffff72ec570, loc=..., ident=0x7ffff7b2bd20, flags=16) at src/dmd/dsymbol.d:1362 #4 0x00005555558dbe32 in dmd.dscope.Scope.search(ref const(dmd.globals.Loc), dmd.identifier.Identifier, dmd.dsymbol.Dsymbol*, int).searchScopes(int) (__capture=0x7fffffffa4e8, flags=16) at src/dmd/dscope.d:464 #5 0x00005555558dbabf in Scope::search(Loc const&, Identifier*, Dsymbol**, int) (this=..., loc=..., ident=0x7ffff7b2bd20, pscopesym=0x7fffffffa558, flags=0) at src/dmd/dscope.d:507 #6 0x0000555555a27e63 in dmd.typesem.resolve(dmd.mtype.Type, ref const(dmd.globals.Loc), dmd.dscope.Scope*, out dmd.expression.Expression, out dmd.mtype.Type, out dmd.dsymbol.Dsymbol, bool).visitIdentifier(dmd.mtype.TypeIdentifier) (__capture=0x7fffffffa5f0, mt=0x7ffff7b2bd60) at src/dmd/typesem.d:2817 #7 0x0000555555a274c9 in dmd.typesem.resolve(dmd.mtype.Type, ref const(dmd.globals.Loc), dmd.dscope.Scope*, out dmd.expression.Expression, out dmd.mtype.Type, out dmd.dsymbol.Dsymbol, bool) (intypeid=false, ps=@0x7fffffffa650: 0x0, pt=@0x7fffffffa640: 0x0, pe=@0x7fffffffa648: 0x0, sc=0x7ffff72de970, loc=..., mt=0x7ffff7b2bd60) at src/dmd/typesem.d:3146 #8 0x000055555590baca in dmd.dtemplate.TemplateInstance.semanticTiargs(ref const(dmd.globals.Loc), dmd.dscope.Scope*, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, int) (flags=0, tiargs=0x7ffff7b2bd40, sc=0x7ffff72de970, loc=...) at src/dmd/dtemplate.d:6594 #9 0x000055555590c2c6 in dmd.dtemplate.TemplateInstance.semanticTiargs(dmd.dscope.Scope*) ( this=0x7ffff7b2be30, sc=0x7ffff72de970) at src/dmd/dtemplate.d:6841 #10 0x00005555559883bb in dmd.expressionsem.semanticY(dmd.expression.DotTemplateInstanceExp, dmd.dscope.Scope*, int) (flag=1, sc=0x7ffff72de970, exp=0x7ffff7b2bdf0) at src/dmd/expressionsem.d:12256 #11 0x0000555555976c76 in ExpressionSemanticVisitor::visit(DotTemplateInstanceExp*) ( this=0x7fffffffaab8, exp=0x7ffff7b2bdf0) at src/dmd/expressionsem.d:6571 #12 0x000055555595bb2a in DotTemplateInstanceExp::accept(Visitor*) (this=0x7ffff7b2bdf0, v=0x7fffffffaab8) at src/dmd/expression.d:4972 #13 0x0000555555986580 in expressionSemantic(Expression*, Scope*) (e=0x7ffff7b2bdf0, sc=0x7ffff72de970) at src/dmd/expressionsem.d:11732 #14 0x0000555555a0d9f3 in StatementSemanticVisitor::visit(WithStatement*) (this=0x7fffffffac38, ws=0x7ffff7b2c040) at src/dmd/statementsem.d:3799 #15 0x00005555559ff282 in WithStatement::accept(Visitor*) (this=0x7ffff7b2c040, v=0x7fffffffac38) at src/dmd/statement.d:2008 #16 0x0000555555a00e2c in statementSemantic(Statement*, Scope*) (s=0x7ffff7b2c040, sc=0x7ffff72de970) at src/dmd/statementsem.d:137 #17 0x0000555555a011cc in StatementSemanticVisitor::visit(CompoundStatement*) (this=0x7fffffffaf78, cs=0x7ffff72ec0c0) at src/dmd/statementsem.d:250 #18 0x00005555559fd12e in CompoundStatement::accept(Visitor*) (this=0x7ffff72ec0c0, v=0x7fffffffaf78) at src/dmd/statement.d:967 #19 0x0000555555a00e2c in statementSemantic(Statement*, Scope*) (s=0x7ffff72ec0c0, sc=0x7ffff72de970) at src/dmd/statementsem.d:137 #20 0x0000555555a0fac0 in dmd.statementsem.semanticNoScope(dmd.statement.Statement, dmd.dscope.Scope*) ( sc=0x7ffff72de970, s=0x7ffff72ec0c0) at src/dmd/statementsem.d:4443 #21 0x0000555555a02606 in StatementSemanticVisitor::visit(ForStatement*) (this=0x7fffffffb0b8, fs=0x7ffff72ec110) at src/dmd/statementsem.d:641 #22 0x00005555559fdc4a in ForStatement::accept(Visitor*) (this=0x7ffff72ec110, v=0x7fffffffb0b8) at src/dmd/statement.d:1298 #23 0x0000555555a00e2c in statementSemantic(Statement*, Scope*) (s=0x7ffff72ec110, sc=0x7ffff72dc180) at src/dmd/statementsem.d:137
Comment #1 by ibuclaw — 2021-07-13T15:51:30Z
reg13815.d --- module imports.reg13815; struct V(W) { ~this() { } } struct Y { import imports.mod13815; I[] Z; } void BB(Y CB) { V!int EB; foreach(K; CB.Z) { import imports.mod13815; with(K.K.Q!G) { } } } --- imports/mod13815.d --- module imports.mod13815; alias F = G; struct I { J!F K; } package struct G { } struct J(M) { union O { } auto Q(R)() { return O(); } } ---
Comment #2 by ibuclaw — 2021-07-13T15:51:57Z
Comment #3 by moonlightsentinel — 2021-07-13T17:09:28Z
Even shorter: --- module imports.reg13815; void trigger() { try { import imports.mod13815; G g; } finally {} } --- module imports.mod13815; package struct G {} --- The segfault only requires access to a package symbol from a try-finally statement (implicitly generated because V has a dtor).
Comment #4 by dlang-bot — 2021-07-13T17:41:08Z
@ibuclaw created dlang/dmd pull request #12867 "fix Issue 22122 - [REG 2.097][ICE] Segmentation fault in in dmd.access.hasPackageAccess" fixing this issue: - fix Issue 22122 - [REG 2.097][ICE] Segmentation fault in in dmd.access.hasPackageAccess https://github.com/dlang/dmd/pull/12867
Comment #5 by dlang-bot — 2021-07-13T22:16:14Z
dlang/dmd pull request #12867 "fix Issue 22122 - [REG 2.097][ICE] Segmentation fault in in dmd.access.hasPackageAccess" was merged into stable: - d2f8a164c3169f44fdee58176b89f2054c822a13 by Iain Buclaw: fix Issue 22122 - [REG 2.097][ICE] Segmentation fault in in dmd.access.hasPackageAccess https://github.com/dlang/dmd/pull/12867
Comment #6 by dlang-bot — 2021-07-23T22:15:22Z
dlang/dmd pull request #12895 "merge stable" was merged into master: - f2fbdcacaa5c41bc4dae02ca7514da233c02d8a5 by Iain Buclaw: fix Issue 22122 - [REG 2.097][ICE] Segmentation fault in in dmd.access.hasPackageAccess https://github.com/dlang/dmd/pull/12895