www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21398] New: DMD segfaults during AST visit

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 puremagic.com
          Reporter: solarliner 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:


_D3dmd6hdrgen13visitWithMaskFCQBc5mtype4TypehPSQBt4root9outbuffer9OutBufferPSQCxQCw11HdrGenStateZv
()

_D3dmd6hdrgen13typeToBufferxFCQBc5mtype4TypePSQBs4root9outbuffer9OutBufferPSQCwQCv11HdrGenStateZv
()




StatementSemanticVisitor::visit(CompoundStatement*) ()

()

_D3dmd12statementsem15semanticNoScopeFCQBl9statement9StatementPSQCk6dscope5ScopeZQBr
()


StatementSemanticVisitor::visit(CompoundStatement*) ()




_D3dmd10dsymbolsem24templateInstanceSemanticFCQBs9dtemplate16TemplateInstancePSQCz6dscope5ScopePSQDr4root5array__T5ArrayTCQEq10expression10ExpressionZQBkZv
()



_D3dmd7initsem9inferTypeFCQy4init11InitializerPSQBu6dscope5ScopeZ8visitExpMFCQCxQCa14ExpInitializerZQCx
()

_D3dmd7initsem9inferTypeFCQy4init11InitializerPSQBu6dscope5ScopeZQBo ()


()


StatementSemanticVisitor::visit(CompoundStatement*) ()





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.

--
Nov 16 2020