www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19523] New: "undefined identifier" causes DMD crash

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

          Issue ID: 19523
           Summary: "undefined identifier" causes DMD crash
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kytodragon e.mail.de

The following code crashes dmd:


void bar () {
        SomeStruct s; // undifined struct
        foo({
                return s;
        });
}

void foo (int delegate() arg) {}


this was discovered with ldc2 version 13.0 and confirmed using dmd version
2.079.0 on Windows 7 x64. Acording to run.dlang.org this also happens in all
newer versions.

DMD log:
onlineapp.d(2): Error: undefined identifier SomeStruct
Segmentation fault (core dumped)

LDC2 log:
onlineapp.d(2): Error: undefined identifier SomeStruct
/dlang/ldc-1.12.0/bin/ldc2(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x1a)[0x2a4b53a]
/dlang/ldc-1.12.0/bin/ldc2(_ZN4llvm3sys17RunSignalHandlersEv+0x35)[0x2a49c35]
/dlang/ldc-1.12.0/bin/ldc2[0x2a49d4c]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x13150)[0x7f726cb57150]
/dlang/ldc-1.12.0/bin/ldc2(_ZN7FuncExp9matchTypeEP4TypeP5ScopePPS_i+0x372)[0xb8d9d2]
/dlang/ldc-1.12.0/bin/ldc2(_ZN14implicitConvTo14ImplicitConvTo5visitEP7FuncExp+0x20)[0xc2a6f0]
/dlang/ldc-1.12.0/bin/ldc2(_ZN12TypeFunction9callMatchEP4TypeP5ArrayIP10ExpressionEiPPKc+0x539)[0xb26749]
/dlang/ldc-1.12.0/bin/ldc2(_ZN25ExpressionSemanticVisitor5visitEP7CallExp+0x1308)[0xb8f828]
/dlang/ldc-1.12.0/bin/ldc2(_ZN24StatementSemanticVisitor5visitEP12ExpStatement+0x62)[0xa933b2]
/dlang/ldc-1.12.0/bin/ldc2(_ZN24StatementSemanticVisitor5visitEP17CompoundStatement+0x130)[0xa93bf0]
/dlang/ldc-1.12.0/bin/ldc2(_ZN16Semantic3Visitor5visitEP15FuncDeclaration+0x160a)[0xac189a]
/dlang/ldc-1.12.0/bin/ldc2(_ZN16Semantic3Visitor5visitEP6Module+0x95)[0xabff35]
/dlang/ldc-1.12.0/bin/ldc2(_Z13mars_mainBodyR5ArrayIPKcES3_+0x14b5)[0xb2be35]
/dlang/ldc-1.12.0/bin/ldc2(_Z7cppmainiPPc+0x1cc9)[0xd00439]
/dlang/ldc-1.12.0/bin/ldc2(_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv+0x50)[0x2b8dc20]
/dlang/ldc-1.12.0/bin/ldc2(_d_run_main+0x1f6)[0x2b8da36]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f726c2181c1]
/dlang/ldc-1.12.0/bin/ldc2[0xa5b8a5]
Error: Error executing /dlang/ldc-1.12.0/bin/ldc2: Segmentation fault (core
dumped)

--
Dec 30 2018