www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Got interesting bug in DMD

reply Andrey Zherikov <andrey.zherikov gmail.com> writes:
Unfortunately this bug is not reproducible (when I reran, DMD 
just segfault'ed) but it might point to the root cause of not 
deterministic behavior of DMD.
Note the index and array size.
```
ERROR: This is a compiler bug.
Please report it via https://issues.dlang.org/enter_bug.cgi
with, preferably, a reduced, reproducible example and the 
information below.
DustMite (https://github.com/CyberShadow/DustMite/wiki) can help 
with the reduction.
---
DMD v2.100.2-dirty
predefs   Have_argparse DigitalMars LittleEndian D_Version2 all 
D_SIMD Windows Win64 CRuntime_Microsoft CppRuntime_Microsoft 
D_InlineAsm_X86_64 X86_64 D_LP64 D_Coverage unittest assert 
D_PreConditions D_PostConditions D_Invariants D_ModuleInfo 
D_Exceptions D_TypeInfo D_HardFloat
binary    C:\D\dmd2\windows\bin64\dmd.exe
version   v2.100.2-dirty
config    C:\D\dmd2\windows\bin64\sc.ini
DFLAGS    -IC:\D\dmd2\windows\bin64\..\..\src\phobos 
-IC:\D\dmd2\windows\bin64\..\..\src\druntime\import
---

core.exception.ArraySliceError C:\Users\vagrant\clones\dmd\src\dm
\root\array.d(305): slice [0 .. 140698326884624] extends past source array of
length 1665507498544
----------------
0x00007FF6E1C6B198
0x00007FF6E1C6B198
0x00007FF6E1C6AA82
0x00007FF6E1C5583B
0x00007FF6E1C55E6B
0x00007FF6E1C54DAA
0x00007FF6E1CA225F
0x00007FF6E18B79A8
0x00007FF6E18B7A29
0x00007FF6E18B7575
0x00007FF6E18BF59E
0x00007FF6E1A56D87
0x00007FF6E18A768A
0x00007FF6E192D8C4
0x00007FF6E18EAA39
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E193A3CD
0x00007FF6E19A2451
0x00007FF6E199F85D
0x00007FF6E192CBD5
0x00007FF6E18EAA39
0x00007FF6E1A7EAE1
0x00007FF6E191970A
0x00007FF6E18FACF9
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E193A3CD
0x00007FF6E19A2451
0x00007FF6E199F85D
0x00007FF6E192CBD5
0x00007FF6E18EAEA8
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E1A43E3C
0x00007FF6E1A4407E
0x00007FF6E19E978C
0x00007FF6E19E8F94
0x00007FF6E19333D2
0x00007FF6E18F593E
0x00007FF6E19F7C9B
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E193A3CD
0x00007FF6E19A2451
0x00007FF6E18F49EC
0x00007FF6E19BB006
0x00007FF6E18E6F1A
0x00007FF6E1AAF6B3
0x00007FF6E1AA97FB
0x00007FF6E18D7F01
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E19F94F2
0x00007FF6E1A43E3C
0x00007FF6E19F0D68
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E193A3CD
0x00007FF6E19A2451
0x00007FF6E199F85D
0x00007FF6E192CBD5
0x00007FF6E18EAEA8
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E193A3CD
0x00007FF6E19A2451
0x00007FF6E199F85D
0x00007FF6E192CBD5
0x00007FF6E18EAEA8
0x00007FF6E1A7EAE1
0x00007FF6E191970A
0x00007FF6E18FACF9
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E18F593E
0x00007FF6E192570A
0x00007FF6E18FB6D6
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E18F593E
0x00007FF6E19F7C9B
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E193A3CD
0x00007FF6E19A2451
0x00007FF6E18F49EC
0x00007FF6E18EB317
0x00007FF6E18EA516
0x00007FF6E1AAF6B3
0x00007FF6E1AA97FB
0x00007FF6E18D7F01
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E193A3CD
0x00007FF6E19A2451
0x00007FF6E19BB133
0x00007FF6E18E96DE
0x00007FF6E19E91EB
0x00007FF6E19F9C3A
0x00007FF6E19E8764
0x00007FF6E19F94F2
0x00007FF6E19F9C3A
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E193A3CD
0x00007FF6E19A2451
0x00007FF6E199F85D
0x00007FF6E192CBD5
0x00007FF6E18EAEA8
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E193A3CD
0x00007FF6E19A2451
0x00007FF6E199F85D
0x00007FF6E192CBD5
0x00007FF6E18EAEA8
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E193A3CD
0x00007FF6E19A2451
0x00007FF6E199F85D
0x00007FF6E192CBD5
0x00007FF6E192C039
0x00007FF6E192B8F3
0x00007FF6E1A7EB0D
0x00007FF6E191970A
0x00007FF6E18FACF9
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E193A3CD
0x00007FF6E19A2451
0x00007FF6E199F85D
0x00007FF6E192CBD5
0x00007FF6E18EAEA8
0x00007FF6E1A7EAE1
0x00007FF6E191970A
0x00007FF6E18FACF9
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E193A3CD
0x00007FF6E19A24D6
0x00007FF6E18F49EC
0x00007FF6E19E91EB
0x00007FF6E19E8764
0x00007FF6E19333D2
0x00007FF6E19310F4
0x00007FF6E1B1B127
0x00007FF6E1B2ECD8
0x00007FF6E1C5C3D9
0x00007FF6E1C5C259
0x00007FF6E1C5C01F
0x00007FF6E1C7E51C
0x00007FFAA7B7244D in BaseThreadInitThunk
0x00007FFAA85ADF78 in RtlUserThreadStart
C:\D\dmd2\windows\bin64\dmd.exe failed with exit code 1.

Process finished with exit code 2
```

PS I'm not able to report a bug because tracking system doesn't 
work with gmail.
Oct 02 2022
next sibling parent reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Sunday, 2 October 2022 at 11:18:49 UTC, Andrey Zherikov wrote:
 [...]
Same with nightly?
Oct 02 2022
parent Andrey Zherikov <andrey.zherikov gmail.com> writes:
On Sunday, 2 October 2022 at 11:35:17 UTC, Imperatorn wrote:
 On Sunday, 2 October 2022 at 11:18:49 UTC, Andrey Zherikov 
 wrote:
 [...]
Same with nightly?
As I said, I can't reproduce exactly this message - dmd fails with segfault usually. Even nightly (DMD64 D Compiler v2.100.2-beta.1) fails: ``` Program received signal SIGSEGV, Segmentation fault. 0x00005555556d2830 in ScopeDsymbol::search(Loc const&, Identifier*, int) () (gdb) where Identifier*, int) () Identifier*, int) () dmd.dscope.Scope*, dmd.expression.Expression, dmd.identifier.Identifier, int) () dmd.expressionsem.semanticY(dmd.expression.DotIdExp, dmd.dscope.Scope*, int) () ExpressionSemanticVisitor::visit(CallExp*) () dmd.initsem.inferType(dmd.init.Initializer, dmd.dscope.Scope*) () DsymbolSemanticVisitor::visit(VarDeclaration*) () ExpressionSemanticVisitor::visit(DeclarationExp*) () StatementSemanticVisitor::visit(ExpStatement*) () StatementSemanticVisitor::visit(CompoundStatement*) () Semantic3Visitor::visit(FuncDeclaration*) () Semantic3Visitor::visit(TemplateInstance*) () dmd.dsymbolsem.templateInstanceSemantic(dmd.dtemplate.TemplateInstance, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*) () dmd.declaration.MatchAccumulator, dmd.dsymbol.Dsymbol, dmd.globals.Loc, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.mtype.Type, dmd.root.array.Array!(dmd.expression.Expression).Array*, const(char)**) () const(dmd.globals.Loc), dmd.dscope.Scope*, dmd.dsymbol.Dsymbol, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.mtype.Type, dmd.root.array.Array!(dmd.expression.Expression).Array*, dmd.func.FuncResolveFlag) () ExpressionSemanticVisitor::visit(CallExp*) () StatementSemanticVisitor::visit(ReturnStatement*) () Semantic3Visitor::visit(FuncDeclaration*) () Semantic3Visitor::visit(TemplateInstance*) () dmd.dsymbolsem.templateInstanceSemantic(dmd.dtemplate.TemplateInstance, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*) () dmd.declaration.MatchAccumulator, dmd.dsymbol.Dsymbol, dmd.globals.Loc, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.mtype.Type, dmd.root.array.Array!(dmd.expression.Expression).Array*, const(char)**) () const(dmd.globals.Loc), dmd.dscope.Scope*, dmd.dsymbol.Dsymbol, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.mtype.Type, dmd.root.array.Array!(dmd.expression.Expression).Array*, dmd.func.FuncResolveFlag) () ExpressionSemanticVisitor::visit(CallExp*) () StatementSemanticVisitor::visit(ReturnStatement*) () Semantic3Visitor::visit(FuncDeclaration*) () ExpressionSemanticVisitor::visit(FuncExp*) () const(dmd.globals.Loc), dmd.dscope.Scope*, out dmd.expression.Expression, out dmd.mtype.Type, out dmd.dsymbol.Dsymbol, bool) () () ExpressionSemanticVisitor::visit(IsExp*) () dmd.initsem.inferType(dmd.init.Initializer, dmd.dscope.Scope*) () DsymbolSemanticVisitor::visit(VarDeclaration*) () dmd.dtemplate.TemplateInstance.expandMembers(dmd.dscope.Scope*) () dmd.dsymbolsem.templateInstanceSemantic(dmd.dtemplate.TemplateInstance, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*) () ExpressionSemanticVisitor::visit(ScopeExp*) () dmd.staticcond.evalStaticCondition(dmd.dscope.Scope*, dmd.expression.Expression, dmd.expression.Expression, out bool, dmd.root.array.Array!(dmd.expression.Expression).Array*).impl(dmd.ex ression.Expression) () dmd.statementsem.flatten(dmd.statement.Statement, dmd.dscope.Scope*) () dmd.statementsem.flatten(dmd.statement.Statement, dmd.dscope.Scope*) () dmd.statementsem.flatten(dmd.statement.Statement, dmd.dscope.Scope*) () StatementSemanticVisitor::visit(CompoundStatement*) () Semantic3Visitor::visit(FuncDeclaration*) () ExpressionSemanticVisitor::visit(FuncExp*) () ExpressionSemanticVisitor::visit(CallExp*) () dmd.initsem.inferType(dmd.init.Initializer, dmd.dscope.Scope*) () DsymbolSemanticVisitor::visit(VarDeclaration*) () ExpressionSemanticVisitor::visit(DeclarationExp*) () StatementSemanticVisitor::visit(ExpStatement*) () StatementSemanticVisitor::visit(CompoundStatement*) () Semantic3Visitor::visit(FuncDeclaration*) () Semantic3Visitor::visit(TemplateInstance*) () dmd.dsymbolsem.templateInstanceSemantic(dmd.dtemplate.TemplateInstance, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*) () dmd.declaration.MatchAccumulator, dmd.dsymbol.Dsymbol, dmd.globals.Loc, dmd.dscope.Scope*, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.mtype.Type, dmd.root.array.Array!(dmd.expression.Expression).Array*, const(char)**) () const(dmd.globals.Loc), dmd.dscope.Scope*, dmd.dsymbol.Dsymbol, dmd.root.array.Array!(dmd.root.rootobject.RootObject).Array*, dmd.mtype.Type, dmd.root.array.Array!(dmd.expression.Expression).Array*, dmd.func.FuncResolveFlag) () ExpressionSemanticVisitor::visit(CallExp*) () StatementSemanticVisitor::visit(ReturnStatement*) () StatementSemanticVisitor::visit(CompoundStatement*) () Semantic3Visitor::visit(FuncDeclaration*) () Semantic3Visitor::visit(TemplateInstance*) () ```
Oct 03 2022
prev sibling parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 10/2/22 7:18 AM, Andrey Zherikov wrote:
 Unfortunately this bug is not reproducible (when I reran, DMD just 
 segfault'ed) but it might point to the root cause of not deterministic 
 behavior of DMD.
Is this an open source project or a project you are willing to share the code for so it can be tested outside your environment? This looks like memory corruption. -Steve
Oct 03 2022
parent reply Tejas <notrealemail gmail.com> writes:
On Monday, 3 October 2022 at 14:48:57 UTC, Steven Schveighoffer 
wrote:
 On 10/2/22 7:18 AM, Andrey Zherikov wrote:
 Unfortunately this bug is not reproducible (when I reran, DMD 
 just segfault'ed) but it might point to the root cause of not 
 deterministic behavior of DMD.
Is this an open source project or a project you are willing to share the code for so it can be tested outside your environment? This looks like memory corruption. -Steve
I think it's his `argparse` package code, judging by a couple of lines of the entire output he posted
Oct 03 2022
parent Andrey Zherikov <andrey.zherikov gmail.com> writes:
On Monday, 3 October 2022 at 15:18:09 UTC, Tejas wrote:
 On Monday, 3 October 2022 at 14:48:57 UTC, Steven Schveighoffer 
 wrote:
 On 10/2/22 7:18 AM, Andrey Zherikov wrote:
 Unfortunately this bug is not reproducible (when I reran, DMD 
 just segfault'ed) but it might point to the root cause of not 
 deterministic behavior of DMD.
Is this an open source project or a project you are willing to share the code for so it can be tested outside your environment? This looks like memory corruption. -Steve
I think it's his `argparse` package code, judging by a couple of lines of the entire output he posted
Yes, it's `argparse` but refactored a bit. I pushed my [work-in-progress branch](https://github.com/andrey-zherikov/argparse/tree/refactor%2Bcrash) so: - Compilable code is at [commit e4a622a](https://github.com/andrey-zherikov/argparse/tree/e4a622a63955301ad7d24 9a083ff96f7f878970) - compilation run was [successfull](https://github.com/andrey-zherikov/argparse/actions/runs/3175747696) - Breaking change ([commit 7fd06f5](https://github.com/andrey-zherikov/argparse/commit/7fd06f545bb55b0b129671 5b898f742d7268059)) - even [ldc core dumped](https://github.com/andrey-zherikov/argparse/actions/runs/3175781 64/jobs/5174408645) (dmd run was cancelled due to this)
Oct 03 2022