Bug 18864 – Building 64-bit dmd on Windows results in a binary that crashes

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2018-05-15T22:14:40Z
Last change time
2018-12-13T11:28:26Z
Assigned to
No Owner
Creator
Atila Neves

Comments

Comment #0 by atila.neves — 2018-05-15T22:14:40Z
Comment #1 by atila.neves — 2018-05-16T14:42:25Z
Further information: the 64-bit dmd artifact from AppVeyor also seems to fail with -int.max/2 every now and again, as does any dmd I compiled with dmd 2.080.0 on Windows. It doesn't always fail, but it results in flaky CI builds.
Comment #2 by atila.neves — 2018-05-16T15:16:35Z
Some of my issues seem to stem from the fact that the top-level win64.mak defaults to making a debug version of dmd and doesn't forward all of the relevant variables to the win64.mak in src/.
Comment #3 by atila.neves — 2018-05-22T17:21:22Z
Using digger to build dmd 2.080.0 works and produces a 64-bit binary. Given that digger uses a relatively old dmd to do so, it would seem the issue arises when using 2.080.0 to build itself.
Comment #4 by atila.neves — 2018-05-24T06:54:05Z
No matter how I build 64-bit dmd 2.080.0 on Windows, it's flaky. Every now and again the compiler fails with return code -1073741819. The return code is always the same, but when it fails seems to be random, with CI builds sometimes passing, and sometimes not. It doesn't always fail on the same dub package.
Comment #5 by r.sagitario — 2018-05-24T21:12:27Z
Please note that -1073741819 is 0xc0000005, i.e. this is an access violation. Does the same code compile with a dmc compiled nightly build?
Comment #6 by atila.neves — 2018-05-25T15:29:30Z
The same code compiles with dmd 2.080.0. The failures are random.
Comment #7 by kinke — 2018-05-25T17:35:37Z
(In reply to Atila Neves from comment #1) > Further information: the 64-bit dmd artifact from AppVeyor also seems to > fail with -int.max/2 every now and again, as does any dmd I compiled with > dmd 2.080.0 on Windows. It doesn't always fail, but it results in flaky CI > builds. I can confirm this regression for LDC on Win32 and Win64 too; I first wrongly attributed it to AppVeyor strangeness. After compiling LDC master with itself and then repeatedly building dub finally led to a frontend crash after about 10 runs, here's the call stack: #0 0x00007ff6bcf99419 Expression::checkPurity(struct Scope *,class VarDeclaration *) C:\LDC\ldc\dmd\expression.d:2133:13 #1 0x00007ff6bcfa73d7 ExpressionSemanticVisitor::visit(class CallExp *) C:\LDC\ldc\dmd\expressionsem.d:2927:17 #2 0x00007ff6bcf98c8f _D3dmd13expressionsem18resolvePropertiesXFPSQBq6dscope5ScopeCQCh10expression10ExpressionQBcZQBg C:\LDC\ldc\dmd\expressionsem.d:156:17 #3 0x00007ff6bceb01d3 resolveProperties(struct Scope *,class Expression *) C:\LDC\ldc\dmd\expressionsem.d:332:5 #4 0x00007ff6bcf99fb0 _D3dmd13expressionsem21preFunctionParametersFPSQBt6dscope5ScopePSQCl4root5array__T5ArrayTCQDk10expression10ExpressionZQBkZb C:\LDC\ldc\dmd\expressionsem.d:468:13 #5 0x00007ff6bcfa7626 ExpressionSemanticVisitor::visit(class CallExp *) C:\LDC\ldc\dmd\expressionsem.d:2962:9 #6 0x00007ff6bcecdd0e StatementSemanticVisitor::visit(class ExpStatement *) C:\LDC\ldc\dmd\statementsem.d:179:13 #7 0x00007ff6bcece5ad StatementSemanticVisitor::visit(class CompoundStatement *) C:\LDC\ldc\dmd\statementsem.d:237:17 #8 0x00007ff6bcecf41c StatementSemanticVisitor::visit(class ScopeStatement *) C:\LDC\ldc\dmd\statementsem.d:415:13 #9 0x00007ff6bced0973 _D3dmd12statementsem15semanticNoScopeFCQBl9statement9StatementPSQCk6dscope5ScopeZQBr C:\LDC\ldc\dmd\statementsem.d:4293:5 #10 0x00007ff6bcecfd7c _D3dmd12statementsem13semanticScopeFCQBj9statement9StatementPSQCi6dscope5ScopeQBqQBtZQBx C:\LDC\ldc\dmd\statementsem.d:4307:5 #11 0x00007ff6bcee6fe7 StatementSemanticVisitor::visit(class TryCatchStatement *) C:\LDC\ldc\dmd\statementsem.d:3824:9 #12 0x00007ff6bcece5ad StatementSemanticVisitor::visit(class CompoundStatement *) C:\LDC\ldc\dmd\statementsem.d:237:17 #13 0x00007ff6bcefb06b Semantic3Visitor::visit(class FuncDeclaration *) C:\LDC\ldc\dmd\semantic3.d:610:17 #14 0x00007ff6bcef8ce2 Semantic3Visitor::visit(class TemplateInstance *) C:\LDC\ldc\dmd\semantic3.d:134:17 #15 0x00007ff6bcfe035c _D3dmd10dsymbolsem24templateInstanceSemanticFCQBs9dtemplate16TemplateInstancePSQCz6dscope5ScopePSQDr4root5array__T5ArrayTCQEq10expression10ExpressionZQBkZv C:\LDC\ldc\dmd\dsymbolsem.d:5696:13 #16 0x00007ff6bcf43328 _D3dmd9dtemplate15functionResolveFPSQBi11declaration5MatchCQCf7dsymbol7DsymbolSQCz7globals3LocPSQDq6dscope5ScopePSQEi4root5array__T5ArrayTCQFhQz10rootobject10RootObjectZQBmCQGp5mtype4TypePSQHfQCxQCv__TQCsTCQHw10expression10ExpressionZQDzPPxaZv C:\LDC\ldc\dmd\dtemplate.d:2831:9 #17 0x00007ff6bced8eb0 resolveFuncCall(struct Loc const &,struct Scope *,class Dsymbol *,struct Array<class RootObject *> *,class Type *,struct Array<class Expression *> *,int) C:\LDC\ldc\dmd\func.d:2749:5 #18 0x00007ff6bcfa83e4 ExpressionSemanticVisitor::visit(class CallExp *) C:\LDC\ldc\dmd\expressionsem.d:3406:17 #19 0x00007ff6bcecdd0e StatementSemanticVisitor::visit(class ExpStatement *) C:\LDC\ldc\dmd\statementsem.d:179:13 #20 0x00007ff6bcece5ad StatementSemanticVisitor::visit(class CompoundStatement *) C:\LDC\ldc\dmd\statementsem.d:237:17 #21 0x00007ff6bcefb06b Semantic3Visitor::visit(class FuncDeclaration *) C:\LDC\ldc\dmd\semantic3.d:610:17 #22 0x00007ff6bcef8ce2 Semantic3Visitor::visit(class TemplateInstance *) C:\LDC\ldc\dmd\semantic3.d:134:17 #23 0x00007ff6bcfe040a _D3dmd10dsymbolsem24templateInstanceSemanticFCQBs9dtemplate16TemplateInstancePSQCz6dscope5ScopePSQDr4root5array__T5ArrayTCQEq10expression10ExpressionZQBkZv C:\LDC\ldc\dmd\dsymbolsem.d:5644:9 #24 0x00007ff6bcf43328 _D3dmd9dtemplate15functionResolveFPSQBi11declaration5MatchCQCf7dsymbol7DsymbolSQCz7globals3LocPSQDq6dscope5ScopePSQEi4root5array__T5ArrayTCQFhQz10rootobject10RootObjectZQBmCQGp5mtype4TypePSQHfQCxQCv__TQCsTCQHw10expression10ExpressionZQDzPPxaZv C:\LDC\ldc\dmd\dtemplate.d:2831:9 #25 0x00007ff6bced8eb0 resolveFuncCall(struct Loc const &,struct Scope *,class Dsymbol *,struct Array<class RootObject *> *,class Type *,struct Array<class Expression *> *,int) C:\LDC\ldc\dmd\func.d:2749:5 #26 0x00007ff6bcfa83e4 ExpressionSemanticVisitor::visit(class CallExp *) C:\LDC\ldc\dmd\expressionsem.d:3406:17 #27 0x00007ff6bcecdd0e StatementSemanticVisitor::visit(class ExpStatement *) C:\LDC\ldc\dmd\statementsem.d:179:13 #28 0x00007ff6bcece5ad StatementSemanticVisitor::visit(class CompoundStatement *) C:\LDC\ldc\dmd\statementsem.d:237:17 #29 0x00007ff6bcecf41c StatementSemanticVisitor::visit(class ScopeStatement *) C:\LDC\ldc\dmd\statementsem.d:415:13 #30 0x00007ff6bced0973 _D3dmd12statementsem15semanticNoScopeFCQBl9statement9StatementPSQCk6dscope5ScopeZQBr C:\LDC\ldc\dmd\statementsem.d:4293:5 #31 0x00007ff6bcede6e2 StatementSemanticVisitor::visit(class IfStatement *) C:\LDC\ldc\dmd\statementsem.d:2218:9 #32 0x00007ff6bcece5ad StatementSemanticVisitor::visit(class CompoundStatement *) C:\LDC\ldc\dmd\statementsem.d:237:17 #33 0x00007ff6bcecf41c StatementSemanticVisitor::visit(class ScopeStatement *) C:\LDC\ldc\dmd\statementsem.d:415:13 #34 0x00007ff6bced0973 _D3dmd12statementsem15semanticNoScopeFCQBl9statement9StatementPSQCk6dscope5ScopeZQBr C:\LDC\ldc\dmd\statementsem.d:4293:5 #35 0x00007ff6bcede6e2 StatementSemanticVisitor::visit(class IfStatement *) C:\LDC\ldc\dmd\statementsem.d:2218:9 #36 0x00007ff6bcece5ad StatementSemanticVisitor::visit(class CompoundStatement *) C:\LDC\ldc\dmd\statementsem.d:237:17 #37 0x00007ff6bced0973 _D3dmd12statementsem15semanticNoScopeFCQBl9statement9StatementPSQCk6dscope5ScopeZQBr C:\LDC\ldc\dmd\statementsem.d:4293:5 #38 0x00007ff6bced06d2 StatementSemanticVisitor::visit(class ForStatement *) C:\LDC\ldc\dmd\statementsem.d:582:13 #39 0x00007ff6bcece5ad StatementSemanticVisitor::visit(class CompoundStatement *) C:\LDC\ldc\dmd\statementsem.d:237:17 #40 0x00007ff6bcecf41c StatementSemanticVisitor::visit(class ScopeStatement *) C:\LDC\ldc\dmd\statementsem.d:415:13 #41 0x00007ff6bced02e7 StatementSemanticVisitor::visit(class ForStatement *) C:\LDC\ldc\dmd\statementsem.d:533:13 #42 0x00007ff6bced6a92 StatementSemanticVisitor::visit(class ForeachStatement *) C:\LDC\ldc\dmd\statementsem.d:1847:17 #43 0x00007ff6bcece5ad StatementSemanticVisitor::visit(class CompoundStatement *) C:\LDC\ldc\dmd\statementsem.d:237:17 #44 0x00007ff6bcefb06b Semantic3Visitor::visit(class FuncDeclaration *) C:\LDC\ldc\dmd\semantic3.d:610:17 #45 0x00007ff6bcfad2da ExpressionSemanticVisitor::visit(class DeclarationExp *) C:\LDC\ldc\dmd\expressionsem.d:3709:9 #46 0x00007ff6bcecdd0e StatementSemanticVisitor::visit(class ExpStatement *) C:\LDC\ldc\dmd\statementsem.d:179:13 #47 0x00007ff6bcece5ad StatementSemanticVisitor::visit(class CompoundStatement *) C:\LDC\ldc\dmd\statementsem.d:237:17 #48 0x00007ff6bcefb06b Semantic3Visitor::visit(class FuncDeclaration *) C:\LDC\ldc\dmd\semantic3.d:610:17 #49 0x00007ff6bcf019ae Semantic3Visitor::visit(class AggregateDeclaration *) C:\LDC\ldc\dmd\semantic3.d:1335:13 #50 0x00007ff6bcef965e Semantic3Visitor::visit(class Module *) C:\LDC\ldc\dmd\semantic3.d:198:13
Comment #8 by kinke — 2018-05-25T19:34:08Z
(In reply to kinke from comment #7) > I can confirm this regression for LDC on Win32 and Win64 too I think I found the culprit causing the sporadic segfaults: https://github.com/dlang/dmd/pull/8294
Comment #9 by atila.neves — 2018-06-13T16:53:11Z
After some experiments, it seems that the release build of 64-bit dmd is the one with problems. The debug build seems to work ok.
Comment #10 by bugzilla — 2018-12-13T11:28:26Z
(In reply to kinke from comment #8) > I think I found the culprit causing the sporadic segfaults: > https://github.com/dlang/dmd/pull/8294 Since that PR was merged, I assume the bug was fixed and will close this. In the future, when entitling PRs that address bugzilla issues, please use: "fix Issue 18864 - Building 64-bit dmd on Windows results in a binary that crashes" so that merging the PR will automatically mark the issue as resolved.