Bug 18871 – DMD "illegal hardware instruction" crash

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-05-18T12:24:32Z
Last change time
2018-06-03T18:30:05Z
Keywords
pull
Assigned to
No Owner
Creator
mmcomando
See also
https://issues.dlang.org/show_bug.cgi?id=18819

Comments

Comment #0 by mmcomando — 2018-05-18T12:24:32Z
After upgrade to "DMD64 D Compiler v2.080.0-dirty" my code crashes. Minimized code: import std.experimental.allocator; import std.experimental.allocator.mallocator; struct Vector{ ~this(){} } struct Bucket{ Vector[2] elements; } struct BucketsChain{ Bucket* addBucket(){ return Mallocator.instance.make!Bucket; } } Backtrace: #0 0x0000563b505051f1 in Interpreter::visit(CallExp*) () #1 0x0000563b504f333c in Interpreter::visit(ExpStatement*) () #2 0x0000563b504f50bd in Interpreter::visit(TryFinallyStatement*) () #3 0x0000563b504f3413 in Interpreter::visit(CompoundStatement*) () #4 0x0000563b504f3413 in Interpreter::visit(CompoundStatement*) () #5 0x0000563b504f23ae in _D3dmd10dinterpret9interpretFCQBc4func15FuncDeclarationPSQCdQCc10InterStatePSQCx4root5array__T5ArrayTCQDw10expression10ExpressionZQBkQBgZQBk () #6 0x0000563b505050a5 in Interpreter::visit(CallExp*) () #7 0x0000563b504a29cb in ctfeInterpret(Expression*) () #8 0x0000563b50456a90 in InitializerSemanticVisitor::visit(ExpInitializer*) () #9 0x0000563b5039f8c5 in Semantic2Visitor::visit(VarDeclaration*) () #10 0x0000563b503a080e in Semantic2Visitor::visit(AttribDeclaration*) () #11 0x0000563b503a080e in Semantic2Visitor::visit(AttribDeclaration*) () #12 0x0000563b503a080e in Semantic2Visitor::visit(AttribDeclaration*) () #13 0x0000563b503a080e in Semantic2Visitor::visit(AttribDeclaration*) () #14 0x0000563b503a080e in Semantic2Visitor::visit(AttribDeclaration*) () #15 0x0000563b5039f1e2 in Semantic2Visitor::visit(TemplateInstance*) () #16 0x0000563b504b5916 in _D3dmd10dsymbolsem24templateInstanceSemanticFCQBs9dtemplate16TemplateInstancePSQCz6dscope5ScopePSQDr4root5array__T5ArrayTCQEq10expression10ExpressionZQBkZv () #17 0x0000563b50474e26 in ExpressionSemanticVisitor::visit(ScopeExp*) () #18 0x0000563b5039ebca in _D3dmd10staticcond19evalStaticConditionFPSQBo6dscope5ScopeCQCf10expression10ExpressionQBcKbZb () #19 0x0000563b5039e78b in Semantic2Visitor::visit(StaticAssert*) () #20 0x0000563b503b3c9e in StatementSemanticVisitor::visit(StaticAssertStatement*) () #21 0x0000563b503a489f in StatementSemanticVisitor::visit(CompoundStatement*) () #22 0x0000563b503936a2 in Semantic3Visitor::visit(FuncDeclaration*) () #23 0x0000563b50478d3d in ExpressionSemanticVisitor::visit(FuncExp*) () #24 0x0000563b503c8a50 in semanticTraits(TraitsExp*, Scope*) () #25 0x0000563b50481073 in ExpressionSemanticVisitor::visit(TraitsExp*) () #26 0x0000563b50457f59 in InferTypeVisitor::visit(ExpInitializer*) () #27 0x0000563b504c3ab8 in DsymbolSemanticVisitor::visit(VarDeclaration*) () #28 0x0000563b504c8a3c in DsymbolSemanticVisitor::attribSemantic(AttribDeclaration*) () #29 0x0000563b504bfd5e in TemplateInstance::tryExpandMembers(Scope*) () #30 0x0000563b504b57fb in _D3dmd10dsymbolsem24templateInstanceSemanticFCQBs9dtemplate16TemplateInstancePSQCz6dscope5ScopePSQDr4root5array__T5ArrayTCQEq10expression10ExpressionZQBkZv () #31 0x0000563b50474e26 in ExpressionSemanticVisitor::visit(ScopeExp*) () #32 0x0000563b5039ebca in _D3dmd10staticcond19evalStaticConditionFPSQBo6dscope5ScopeCQCf10expression10ExpressionQBcKbZb () #33 0x0000563b5039ec61 in _D3dmd10staticcond19evalStaticConditionFPSQBo6dscope5ScopeCQCf10expression10ExpressionQBcKbZb () #34 0x0000563b5039eb27 in _D3dmd10staticcond19evalStaticConditionFPSQBo6dscope5ScopeCQCf10expression10ExpressionQBcKbZb () #35 0x0000563b50525693 in StaticIfCondition::include(Scope*) () #36 0x0000563b503ea932 in ConditionalStatement::flatten(Scope*) () #37 0x0000563b503a47be in StatementSemanticVisitor::visit(CompoundStatement*) () #38 0x0000563b503936a2 in Semantic3Visitor::visit(FuncDeclaration*) () #39 0x0000563b50391552 in Semantic3Visitor::visit(TemplateInstance*) () #40 0x0000563b504b5ab8 in _D3dmd10dsymbolsem24templateInstanceSemanticFCQBs9dtemplate16TemplateInstancePSQCz6dscope5ScopePSQDr4root5array__T5ArrayTCQEq10expression10ExpressionZQBkZv () #41 0x0000563b5041c39e in _D3dmd9dtemplate15functionResolveFPSQBi11declaration5MatchCQCf7dsymbol7DsymbolSQCz7globals3LocPSQDq6dscope5ScopePSQEi4root5array__T5ArrayTCQFhQz10rootobject10RootObjectZQBmCQGp5mtype4TypePSQHfQCxQCv__TQCsTCQHw10expression10ExpressionZQDzPPxaZv () #42 0x0000563b50398efd in resolveFuncCall(Loc const&, Scope*, Dsymbol*, Array<RootObject*>*, Type*, Array<Expression*>*, int) () #43 0x0000563b5047b465 in ExpressionSemanticVisitor::visit(CallExp*) () #44 0x0000563b5048610b in resolveUFCSProperties(Scope*, Expression*, Expression*) () #45 0x0000563b50486d8e in ExpressionSemanticVisitor::visit(DotTemplateInstanceExp*) () #46 0x0000563b503b7756 in StatementSemanticVisitor::visit(ReturnStatement*) () #47 0x0000563b503a489f in StatementSemanticVisitor::visit(CompoundStatement*) () #48 0x0000563b503936a2 in Semantic3Visitor::visit(FuncDeclaration*) () #49 0x0000563b5039df2d in Semantic3Visitor::visit(AggregateDeclaration*) () #50 0x0000563b50391e7a in Semantic3Visitor::visit(Module*) () #51 0x0000563b504316da in dmd.mars.tryMain(ulong, const(char)**) () #52 0x0000563b505cdcd0 in rt.dmain2._d_run_main(int, char**, extern(C) int(char[][]) function).runAll() () #53 0x0000563b505cdb56 in _d_run_main () #54 0x00007f452688006b in __libc_start_main () from /usr/lib/libc.so.6 #55 0x0000563b5034475a in _start ()
Comment #1 by slavo5150 — 2018-05-18T12:55:32Z
Works in 2.079. Begins to fail in 2.080. https://run.dlang.io/is/iBdoDg
Comment #2 by slavo5150 — 2018-05-18T13:24:12Z
Comment #3 by slavo5150 — 2018-05-18T14:24:01Z
Test case without dependency on std.experiment.allocator: struct S { ~this(){} } bool f() { try { return true; } finally { _ArrayDtor([S(), S()]); } } void main() { enum b = f(); }
Comment #4 by slavo5150 — 2018-05-19T05:36:49Z
According to digger this Phobos commit caused the regression. digger: 082e53c2fb5c28179bef45554d1b2157ffc4fdc8 is the first bad commit commit 082e53c2fb5c28179bef45554d1b2157ffc4fdc8 Author: The Dlang Bot <[email protected]> Date: Mon Apr 16 01:40:09 2018 +0200 phobos: Merge pull request #6411 from n8sh/allocate-zeroed https://github.com/dlang/phobos/pull/6411 make/makeArray: take advantage of allocators with smth. faster than allocate+memset zero merged-on-behalf-of: Sebastian Wilzbach <[email protected]> diff --git a/phobos b/phobos index e13e3889a..7016abafa 160000 --- a/phobos +++ b/phobos @@ -1 +1 @@ -Subproject commit e13e3889ac9f7dcaec8829af0fb13d60f0391f55 +Subproject commit 7016abafadcdaab1740937fab636c4085feca228 digger: Bisection completed successfully.
Comment #5 by n8sh.secondary — 2018-05-20T11:10:26Z
See issue #18819.
Comment #6 by bugzilla — 2018-05-28T21:48:39Z
(In reply to Mike Franklin from comment #2) > Attempted fix: https://github.com/dlang/dmd/pull/8260 This was pulled. Does it fix it?
Comment #7 by slavo5150 — 2018-05-28T23:04:14Z
(In reply to Walter Bright from comment #6) > (In reply to Mike Franklin from comment #2) > > Attempted fix: https://github.com/dlang/dmd/pull/8260 > > This was pulled. Does it fix it? Yes, it appears to fix error.
Comment #8 by github-bugzilla — 2018-06-03T18:30:05Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/b8f3b7a9f1e33d3c130a04e1459ca601cad7127a Fix Issue 18871 & 18819 - DMD illegal hardware instruction crash https://github.com/dlang/dmd/commit/d2d7cc1cc847b7fc9e762924f4ab584474b6219f Merge pull request #8260 from JinShil/fix_18871 Fix Issue 18871 & 18819 - DMD illegal hardware instruction crash merged-on-behalf-of: Jacob Carlborg <[email protected]>