www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22365] New: Compiler crash: tcs.body_ null in

https://issues.dlang.org/show_bug.cgi?id=22365

          Issue ID: 22365
           Summary: Compiler crash: tcs.body_ null in
                    StatementSemanticVisitor.visit(TryCatchStatement) in
                    semantic3 pass (dmd/statementsem.d:3956)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: evilrat666 gmail.com

Crashes when building one specific project:
https://github.com/buggins/dlangui

Related issue:
https://github.com/buggins/dlangui/issues/616

Happens in class constructor with debug statement, however using minimal
repro-case doesn't expose this behavior, also no other project I tried had
this.

Note that it is possible that it is only happens doing -release/optimization
builds.

(this code won't trigger it)
------------
import std.stdio;

class Test
{
    this() 
    {
        debug writeln("hello");
    }
}

void main()
{
    auto test = new Test();
}
-----------

CALL STACK for dmd as a library running semantic3 for dlangui issue
----------------------

dmdlib.exe!_D2rt15deh_win64_posix9terminateFZv() (Unknown Source:0)

dmdlib.exe!_d_assertp() (Unknown Source:0)

dmdlib.exe!dmd.statementsem.StatementSemanticVisitor.visit(dmd.statement.TryCatchStatement
* tcs) Line 3956
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\statementsem.d:3956)

dmdlib.exe!dmd.statement.TryCatchStatement.accept(dmd.visitor.Visitor * v) Line
1582
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\statement.d:1582)

dmdlib.exe!dmd.statementsem.statementSemantic(dmd.statement.Statement * s,
dmd.dscope.Scope * sc) Line 143
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\statementsem.d:143)

dmdlib.exe!dmd.semantic3.Semantic3Visitor.visit(dmd.func.FuncDeclaration *
funcdecl) Line 581
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\semantic3.d:581)

dmdlib.exe!dmd.semantic3.Semantic3Visitor.visit(dmd.func.CtorDeclaration *
ctor) Line 1445
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\semantic3.d:1445)

dmdlib.exe!dmd.func.CtorDeclaration.accept(dmd.visitor.Visitor * v) Line 3660
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\func.d:3660)

dmdlib.exe!dmd.semantic3.semantic3(dmd.dsymbol.Dsymbol * dsym, dmd.dscope.Scope
* sc) Line 82
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\semantic3.d:82)

dmdlib.exe!dmd.semantic3.Semantic3Visitor.visit(dmd.aggregate.AggregateDeclaration
* ad) Line 1505
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\semantic3.d:1505)

dmdlib.exe!dmd.parsetimevisitor.ParseTimeVisitor!(dmd.astcodegen.ASTCodegen).ParseTimeVisitor.visit(dmd.dclass.ClassDeclaration
* s) Line 90
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\parsetimevisitor.d:90)

dmdlib.exe!dmd.dclass.ClassDeclaration.accept(dmd.visitor.Visitor * v) Line 999
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\dclass.d:999)

dmdlib.exe!dmd.semantic3.semantic3(dmd.dsymbol.Dsymbol * dsym, dmd.dscope.Scope
* sc) Line 82
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\semantic3.d:82)

dmdlib.exe!dmd.semantic3.Semantic3Visitor.visit(dmd.dmodule.Module * mod) Line
195
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\semantic3.d:195)

dmdlib.exe!dmd.dmodule.Module.accept(dmd.visitor.Visitor * v) Line 1542
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\dmodule.d:1542)

dmdlib.exe!dmd.semantic3.semantic3(dmd.dsymbol.Dsymbol * dsym, dmd.dscope.Scope
* sc) Line 82
(c:\Users\devr\AppData\Local\dub\packages\dmd-master\dmd\src\dmd\semantic3.d:82)

dmdlib.exe!app.processDecls.__foreachbody17(string * __capture,
dmd.dmodule.Module * * __applyArg1) Line 288 (d:\prog\dmdlib\source\app.d:288)

dmdlib.exe!_aaApply2() (Unknown Source:0)

dmdlib.exe!app.processDecls(app.RunParams params) Line 286
(d:\prog\dmdlib\source\app.d:286)

dmdlib.exe!D main(string[] args) Line 69 (d:\prog\dmdlib\source\app.d:69)

----------------------

--
Oct 08 2021