[Issue 21398] New: DMD segfaults during AST visit
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 16 17:38:26 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21398
Issue ID: 21398
Summary: DMD segfaults during AST visit
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: solarliner at gmail.com
Created attachment 1810
--> https://issues.dlang.org/attachment.cgi?id=1810&action=edit
segfault repro
Hi,
DMD has been acting up on this piece of code I have attached as reproduction.
If, within main (in `app.d`), there is no reference to the custom types, then
compilation and execution are fine. However as soon as I introduce one of the
types I defined in `mem.d`, the compiler segfaults.
I've caught a backtrace in gdb:
#0 0x00005555557a1421 in
_D3dmd6hdrgen13visitWithMaskFCQBc5mtype4TypehPSQBt4root9outbuffer9OutBufferPSQCxQCw11HdrGenStateZv
()
#1 0x00005555557a173b in
_D3dmd6hdrgen13typeToBufferxFCQBc5mtype4TypePSQBs4root9outbuffer9OutBufferPSQCwQCv11HdrGenStateZv
()
#2 0x00005555556914f3 in Type::toChars() const ()
#3 0x00005555557bed49 in ExpressionSemanticVisitor::visit(CallExp*) ()
#4 0x00005555556f2e4c in StatementSemanticVisitor::visit(ExpStatement*) ()
#5 0x00005555556f383a in
StatementSemanticVisitor::visit(CompoundStatement*) ()
#6 0x00005555556f4caf in StatementSemanticVisitor::visit(ScopeStatement*)
()
#7 0x00005555556f5fab in
_D3dmd12statementsem15semanticNoScopeFCQBl9statement9StatementPSQCk6dscope5ScopeZQBr
()
#8 0x00005555557028b3 in StatementSemanticVisitor::visit(IfStatement*) ()
#9 0x00005555556f383a in
StatementSemanticVisitor::visit(CompoundStatement*) ()
#10 0x000055555571e3bb in Semantic3Visitor::visit(FuncDeclaration*) ()
#11 0x00005555557276ba in Semantic3Visitor::visit(AggregateDeclaration*) ()
#12 0x000055555571c0e1 in Semantic3Visitor::visit(TemplateInstance*) ()
#13 0x00005555557fe0d8 in
_D3dmd10dsymbolsem24templateInstanceSemanticFCQBs9dtemplate16TemplateInstancePSQCz6dscope5ScopePSQDr4root5array__T5ArrayTCQEq10expression10ExpressionZQBkZv
()
#14 0x00005555557b6fe4 in ExpressionSemanticVisitor::visit(ScopeExp*) ()
#15 0x00005555557be6c4 in ExpressionSemanticVisitor::visit(CallExp*) ()
#16 0x00005555557959c7 in
_D3dmd7initsem9inferTypeFCQy4init11InitializerPSQBu6dscope5ScopeZ8visitExpMFCQCxQCa14ExpInitializerZQCx
()
#17 0x00005555557955bd in
_D3dmd7initsem9inferTypeFCQy4init11InitializerPSQBu6dscope5ScopeZQBo ()
#18 0x000055555580c5fd in DsymbolSemanticVisitor::visit(VarDeclaration*) ()
#19 0x00005555557c1be1 in ExpressionSemanticVisitor::visit(DeclarationExp*)
()
#20 0x00005555556f2e4c in StatementSemanticVisitor::visit(ExpStatement*) ()
#21 0x00005555556f383a in
StatementSemanticVisitor::visit(CompoundStatement*) ()
#22 0x000055555571e3bb in Semantic3Visitor::visit(FuncDeclaration*) ()
#23 0x000055555571c841 in Semantic3Visitor::visit(Module*) ()
#24 0x000055555576e380 in _D3dmd4mars7tryMainFmPPxaKSQz7globals5ParamZi ()
#25 0x000055555577889f in D main ()
As I am new with D, the code I wrote may not be correct, however I don't think
compilers are supposed to find code so ugly they crash, lol.
--
More information about the Digitalmars-d-bugs
mailing list