www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18334] New: Segfault on FuncExp::matchType while trying to

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

          Issue ID: 18334
           Summary: Segfault on FuncExp::matchType while trying to compile
                    invalid .d file
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: tetyys tetyys.com

Following invalid vibe.d program causes a crash on dmd v2.078.1 (vibe.d
0.8.3-alpha.2, vibe-core 1.4.0-alpha.1, stdx-allocator 2.77.0, eventcore
0.8.27, taggedalgebraic 0.10.9):

import vibe.vibe;
void main()
{
    auto router = URLRouter;
    router.registerWebInterface(new WebService);
}

class WebService
{
    struct C {
    }

    enum d ;

     d
    a(C a)
    {
    }

    void b()
    {
    }

}

Results in:
source/app.d(4,16): Error: type URLRouter has no value
../../.dub/packages/vibe-d-0.8.3-alpha.2/vibe-d/utils/vibe/internal/meta/funcattr.d(313,83):
Error: type d is not an expression
/usr/include/dmd/phobos/std/meta.d(915,20): Error: template instance
vibe.internal.meta.funcattr.pred!(d) error instantiating
../../.dub/packages/vibe-d-0.8.3-alpha.2/vibe-d/utils/vibe/internal/meta/funcattr.d(378,30):
       instantiated from here: Filter!(isInputAttribute, d)
../../.dub/packages/vibe-d-0.8.3-alpha.2/vibe-d/utils/vibe/internal/meta/funcattr.d(134,16):
       instantiated from here: AttributedParameterMetadata!(a)
../../.dub/packages/vibe-d-0.8.3-alpha.2/vibe-d/web/vibe/web/web.d(899,22):    
   instantiated from here: IsAttributedParameter!(a, "a")
../../.dub/packages/vibe-d-0.8.3-alpha.2/vibe-d/web/vibe/web/web.d(185,34):    
   instantiated from here: handleRequest!("a", a, WebService)
source/app.d(5,29):        instantiated from here:
registerWebInterface!(WebService, cast(MethodStyle)5)
Segmentation fault
/usr/bin/dmd failed with exit code 139.


Stack trace:






int) ()

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*).applyFunction(dmd.func.FuncDeclaration)
()

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*).__lambda10(dmd.dsymbol.Dsymbol)
()

int(dmd.dsymbol.Dsymbol) delegate) ()

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*) ()

Array<RootObject*>*, Type*, Array<Expression*>*, int) ()





()




StatementSemanticVisitor::visit(UnrolledLoopStatement*) ()




()




StatementSemanticVisitor::visit(UnrolledLoopStatement*) ()




()







dmd.dsymbolsem.templateInstanceSemantic(dmd.dtemplate.TemplateInstance,
dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*) ()

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*) ()

Array<RootObject*>*, Type*, Array<Expression*>*, int) ()





()







   0x00000000005f73f2 <+1338>:  pop    %rbp
   0x00000000005f73f3 <+1339>:  retq
   0x00000000005f73f4 <+1340>:  mov    0x28(%rdx),%rsi
   0x00000000005f73f8 <+1344>:  mov    0x70(%rsi),%rbx
   0x00000000005f73fc <+1348>:  mov    0x18(%rdx),%rax
   0x00000000005f7400 <+1352>:  rex movzbl 0x8(%rax),%edi
   0x00000000005f7405 <+1357>:  cmp    0x8(%r13),%dil
   0x00000000005f7409 <+1361>:  setne  %cl
   0x00000000005f740c <+1364>:  mov    %cl,-0x30(%rbp)
   0x00000000005f740f <+1367>:  cmpb   $0x0,0x1b8(%rsi)
   0x00000000005f7416 <+1374>:  je     0x5f74ee
<_ZN7FuncExp9matchTypeEP4TypeP5ScopePPS_i+1590>
   0x00000000005f741c <+1380>:  mov    0x80(%r15),%rsi
   0x00000000005f7423 <+1387>:  mov    0x80(%rbx),%rdi
=> 0x00000000005f742a <+1394>:  mov    (%rdi),%rax
   0x00000000005f742d <+1397>:  rex.W callq *0x118(%rax)
   0x00000000005f7434 <+1404>:  cmp    $0x1,%eax
   0x00000000005f7437 <+1407>:  jne    0x5f74ee
<_ZN7FuncExp9matchTypeEP4TypeP5ScopePPS_i+1590>
   0x00000000005f743d <+1413>:  movb   $0x1,-0x30(%rbp)

   0x00000000005f7448 <+1424>:  callq  0x7e6798 <_d_newclass>
   0x00000000005f744d <+1429>:  mov    %rax,%r14
   0x00000000005f7450 <+1432>:  mov    0x88(%rbx),%r9
   0x00000000005f7457 <+1439>:  mov    0x80(%r15),%r8
   0x00000000005f745e <+1446>:  mov    0x90(%rbx),%ecx
   0x00000000005f7464 <+1452>:  mov    0x9c(%rbx),%edx
   0x00000000005f746a <+1458>:  xor    %esi,%esi
   0x00000000005f746c <+1460>:  mov    %r14,%rdi
   0x00000000005f746f <+1463>:  callq  0x6a0fec
<_D3dmd5mtype12TypeFunction6__ctorMFPS3dmd4root5array32__T5ArrayTC3dmd5mtype9ParameterZ5ArrayC3dmd5mtype4TypeiE3dmd7globals4LINKmZC3dmd5mtype12TypeFunction>

--
Jan 30 2018