Bug 18645 – [Reg 2.078] DMD segmentation fault

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-03-21T18:56:20Z
Last change time
2018-04-15T01:01:01Z
Keywords
pull
Assigned to
No Owner
Creator
Mihails Strasuns

Comments

Comment #0 by mihails.strasuns.contractor — 2018-03-21T18:56:20Z
DMD 2.079 (but also happens with earlier versions). Happens in large private codebase, will try to dustmite later this week. For now full stack trace: Program terminated with signal SIGSEGV, Segmentation fault. #0 0x0000000000593a1c in BinExp::setNoderefOperands() (this=0x7f14983db410) at dmd/expression.d:5036 5036 if (e1.op == TOK.dotIdentifier) (gdb) bt #0 0x0000000000593a1c in BinExp::setNoderefOperands() (this=0x7f14983db410) at dmd/expression.d:5036 #1 0x00000000005b2dbb in ExpressionSemanticVisitor::visit(CmpExp*) (this=0x7ffdec919508, exp=0x7f14983db410) at dmd/expressionsem.d:8714 #2 0x0000000000597172 in CmpExp::accept(Visitor*) (this=0x7f14983db410, v=0x7ffdec919508) at dmd/expression.d:6841 #3 0x00000000005b4e5b in expressionSemantic(Expression*, Scope*) (e=0x7f14983db410, sc=0x7f149837b840) at dmd/expressionsem.d:9437 #4 0x0000000000535e9e in EnumDeclaration::getMaxMinValue(Loc const&, Identifier*) ( this=0x7f149b4489d0, loc=..., id=0x7f14a04ab3a0) at dmd/denum.d:235 #5 0x0000000000607854 in TypeEnum::getProperty(Loc const&, Identifier*, int) (this=0x2365700, loc=..., ident=0x7f14a04ab3a0, flag=0) at dmd/mtype.d:7874 #6 0x00000000005675d2 in DsymbolSemanticVisitor::visit(EnumMember*) (this=0x7ffdec919930, em=0x7f149b448d10) at dmd/dsymbolsem.d:2044 #7 0x000000000053649a in EnumMember::accept(Visitor*) (this=0x7f149b448d10, v=0x7ffdec919930) at dmd/denum.d:382 #8 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149b448d10, sc=0x7f149837b840) at dmd/dsymbolsem.d:103 #9 0x0000000000566bf2 in DsymbolSemanticVisitor::visit(EnumDeclaration*) (this=0x7ffdec919ab0, ed=0x7f149b4489d0) at dmd/dsymbolsem.d:1868 #10 0x0000000000536242 in EnumDeclaration::accept(Visitor*) (this=0x7f149b4489d0, v=0x7ffdec919ab0) at dmd/denum.d:324 #11 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149b4489d0, sc=0x7f149836fcc0) at dmd/dsymbolsem.d:103 #12 0x0000000000565193 in DsymbolSemanticVisitor::attribSemantic(AttribDeclaration*) ( this=0x7ffdec919bb0, ad=0x7f149b4492f0) at dmd/dsymbolsem.d:1290 #13 0x00000000005651f5 in DsymbolSemanticVisitor::visit(AttribDeclaration*) (this=0x7ffdec919bb0, atd=0x7f149b4492f0) at dmd/dsymbolsem.d:1302 #14 0x000000000063b757 in ParseTimeVisitor<ASTCodegen>::visit(ProtDeclaration*) ( this=0x7ffdec919bb0, s=0x7f149b4492f0) at dmd/parsetimevisitor.d:71 #15 0x0000000000507676 in ProtDeclaration::accept(Visitor*) (this=0x7f149b4492f0, v=0x7ffdec919bb0) at dmd/attrib.d:605 #16 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149b4492f0, sc=0x7f149b449560) at dmd/dsymbolsem.d:103 #17 0x000000000056652e in DsymbolSemanticVisitor::visit(Module*) (this=0x7ffdec919c60, m=0x7f149b447f30) at dmd/dsymbolsem.d:1677 #18 0x00000000005521aa in Module::accept(Visitor*) (this=0x7f149b447f30, v=0x7ffdec919c60) at dmd/dmodule.d:1322 #19 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149b447f30, sc=0x0) at dmd/dsymbolsem.d:103 #20 0x0000000000564779 in DsymbolSemanticVisitor::visit(Import*) (this=0x7ffdec919f80, imp=0x7f149b623a30) at dmd/dsymbolsem.d:1146 #21 0x000000000053703b in Import::accept(Visitor*) (this=0x7f149b623a30, v=0x7ffdec919f80) at dmd/dimport.d:309 #22 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149b623a30, sc=0x7f149b63ef10) at dmd/dsymbolsem.d:103 #23 0x000000000056652e in DsymbolSemanticVisitor::visit(Module*) (this=0x7ffdec91a030, m=0x7f149b623170) at dmd/dsymbolsem.d:1677 #24 0x00000000005521aa in Module::accept(Visitor*) (this=0x7f149b623170, v=0x7ffdec91a030) at dmd/dmodule.d:1322 #25 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149b623170, sc=0x0) at dmd/dsymbolsem.d:103 #26 0x0000000000564779 in DsymbolSemanticVisitor::visit(Import*) (this=0x7ffdec91a350, imp=0x7f149b61d130) at dmd/dsymbolsem.d:1146 #27 0x000000000053703b in Import::accept(Visitor*) (this=0x7f149b61d130, v=0x7ffdec91a350) at dmd/dimport.d:309 #28 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149b61d130, sc=0x7f149b622e10) at dmd/dsymbolsem.d:103 #29 0x000000000056652e in DsymbolSemanticVisitor::visit(Module*) (this=0x7ffdec91a400, m=0x7f149b61cdd0) at dmd/dsymbolsem.d:1677 #30 0x00000000005521aa in Module::accept(Visitor*) (this=0x7f149b61cdd0, v=0x7ffdec91a400) at dmd/dmodule.d:1322 #31 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149b61cdd0, sc=0x0) at dmd/dsymbolsem.d:103 #32 0x0000000000564779 in DsymbolSemanticVisitor::visit(Import*) (this=0x7ffdec91a720, imp=0x7f149b6178c0) at dmd/dsymbolsem.d:1146 ---Type <return> to continue, or q <return> to quit--- #33 0x000000000053703b in Import::accept(Visitor*) (this=0x7f149b6178c0, v=0x7ffdec91a720) at dmd/dimport.d:309 #34 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149b6178c0, sc=0x7f149b61a900) at dmd/dsymbolsem.d:103 #35 0x000000000056652e in DsymbolSemanticVisitor::visit(Module*) (this=0x7ffdec91a7d0, m=0x7f149b6173d0) at dmd/dsymbolsem.d:1677 #36 0x00000000005521aa in Module::accept(Visitor*) (this=0x7f149b6173d0, v=0x7ffdec91a7d0) at dmd/dmodule.d:1322 #37 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149b6173d0, sc=0x0) at dmd/dsymbolsem.d:103 #38 0x0000000000564779 in DsymbolSemanticVisitor::visit(Import*) (this=0x7ffdec91aaf0, imp=0x7f149e4d3a30) at dmd/dsymbolsem.d:1146 #39 0x000000000053703b in Import::accept(Visitor*) (this=0x7f149e4d3a30, v=0x7ffdec91aaf0) at dmd/dimport.d:309 #40 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149e4d3a30, sc=0x7f149e4e6b80) at dmd/dsymbolsem.d:103 #41 0x000000000056652e in DsymbolSemanticVisitor::visit(Module*) (this=0x7ffdec91aba0, m=0x7f149e4d3540) at dmd/dsymbolsem.d:1677 #42 0x00000000005521aa in Module::accept(Visitor*) (this=0x7f149e4d3540, v=0x7ffdec91aba0) at dmd/dmodule.d:1322 #43 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149e4d3540, sc=0x0) at dmd/dsymbolsem.d:103 #44 0x0000000000564779 in DsymbolSemanticVisitor::visit(Import*) (this=0x7ffdec91aec0, imp=0x7f149e4b9310) at dmd/dsymbolsem.d:1146 #45 0x000000000053703b in Import::accept(Visitor*) (this=0x7f149e4b9310, v=0x7ffdec91aec0) at dmd/dimport.d:309 #46 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149e4b9310, sc=0x7f149e4c7fd0) at dmd/dsymbolsem.d:103 #47 0x000000000056652e in DsymbolSemanticVisitor::visit(Module*) (this=0x7ffdec91af70, m=0x7f149e4b8e20) at dmd/dsymbolsem.d:1677 #48 0x00000000005521aa in Module::accept(Visitor*) (this=0x7f149e4b8e20, v=0x7ffdec91af70) at dmd/dmodule.d:1322 #49 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149e4b8e20, sc=0x0) at dmd/dsymbolsem.d:103 #50 0x0000000000564779 in DsymbolSemanticVisitor::visit(Import*) (this=0x7ffdec91b290, imp=0x7f149f128840) at dmd/dsymbolsem.d:1146 #51 0x000000000053703b in Import::accept(Visitor*) (this=0x7f149f128840, v=0x7ffdec91b290) at dmd/dimport.d:309 #52 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149f128840, sc=0x7f149f153c40) at dmd/dsymbolsem.d:103 #53 0x000000000056652e in DsymbolSemanticVisitor::visit(Module*) (this=0x7ffdec91b340, m=0x7f149f1282d0) at dmd/dsymbolsem.d:1677 #54 0x00000000005521aa in Module::accept(Visitor*) (this=0x7f149f1282d0, v=0x7ffdec91b340) at dmd/dmodule.d:1322 #55 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f149f1282d0, sc=0x0) at dmd/dsymbolsem.d:103 #56 0x0000000000564779 in DsymbolSemanticVisitor::visit(Import*) (this=0x7ffdec91b660, imp=0x7f14a04ae010) at dmd/dsymbolsem.d:1146 #57 0x000000000053703b in Import::accept(Visitor*) (this=0x7f14a04ae010, v=0x7ffdec91b660) at dmd/dimport.d:309 #58 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f14a04ae010, sc=0x7f14a04af240) at dmd/dsymbolsem.d:103 #59 0x000000000056652e in DsymbolSemanticVisitor::visit(Module*) (this=0x7ffdec91b710, m=0x7f14a04adca0) at dmd/dsymbolsem.d:1677 #60 0x00000000005521aa in Module::accept(Visitor*) (this=0x7f14a04adca0, v=0x7ffdec91b710) at dmd/dmodule.d:1322 #61 0x0000000000561459 in dsymbolSemantic(Dsymbol*, Scope*) (dsym=0x7f14a04adca0, sc=0x0) at dmd/dsymbolsem.d:103 #62 0x00000000005f213b in dmd.mars.tryMain(ulong, const(char)**) (argv=0x7ffdec91c748, argc=26) at dmd/mars.d:795 #63 0x00000000005f3537 in D main () at dmd/mars.d:1089 (gdb) p e1 $1 = (dmd.expression.Expression *) 0x0
Comment #1 by mihails.strasuns.contractor — 2018-03-22T16:15:48Z
This crashes 2.079 and 2.078, but compiles on 2.071 (haven't checked versions in between yet): ``` enum A { x = global, y } static global = INIT; immutable INIT = 42; ```
Comment #2 by mihails.strasuns.contractor — 2018-03-22T16:19:54Z
Even more reduced case: ``` immutable INIT = 42; enum A { x = INIT, y } ```
Comment #3 by mihails.strasuns.contractor — 2018-03-23T08:28:10Z
Regression introduced by this commit: commit 334f853e8371fdab46875bf3316ba78a7c237578 Author: JinShil <[email protected]> Date: Tue Nov 21 22:36:35 2017 +0900 Fix Issue 12385 - Enum member should not be modifiable when the member is immutable
Comment #4 by slavo5150 — 2018-03-23T11:35:37Z
Comment #5 by bugzilla — 2018-03-26T02:46:20Z
Comment #6 by github-bugzilla — 2018-04-06T21:05:15Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/5c11b2969441e2a05596e267fdfd944df21cd615 Fix Issue 18645 - DMD segmentation fault (Enum Initialization) https://github.com/dlang/dmd/commit/faa6f89bfb190b78619688897ccd49bc9750cd44 Merge pull request #8072 from JinShil/fix_18645 Fix Issue 18645 - DMD segmentation fault (Enum Initialization)
Comment #7 by code — 2018-04-15T01:01:01Z
(In reply to Mihails Strasuns from comment #1) > This crashes 2.079 and 2.078, but compiles on 2.071 (haven't checked > versions in between yet): Using the install.sh script, it's trivial to switch to a different compiler. Quite helpful for an early narrowing of a bisect range. Please prefix regressions with [Reg 2.07x], i.e. the version number that first contains the regression, use the upcoming major version for regressions against master. This makes it simple to see which versions are affected by a certain bug.