March 06
https://issues.dlang.org/show_bug.cgi?id=24431

          Issue ID: 24431
           Summary: dmd -vcg-ast crashes
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: davispuh@gmail.com

When I invoke

$ dmd -vcg-ast program.d


It crashes:
Thread 1 (Thread 0x7ffff7c65d00 (LWP 2125794) "dmd"):
#0  0x0000555555697457 in
toCBuffer::DsymbolPrettyPrintVisitor::visit(FuncDeclaration*) ()
#1  0x000055555569a4ed in
dmd.hdrgen.dumpTemplateInstance(dmd.dtemplate.TemplateInstance, ref
dmd.common.outbuffer.OutBuffer, ref dmd.hdrgen.HdrGenState) ()
#2  0x0000555555699615 in toCBuffer::DsymbolPrettyPrintVisitor::visit(Module*)
()
#3  0x0000555555907cd9 in moduleToBuffer(OutBuffer&, bool, Module*) ()
#4  0x0000555555914e27 in dmd.main.tryMain(ulong, const(char)**, ref
dmd.globals.Param) ()
#5  0x0000555555912501 in D main ()

Dump of assembler code for function
toCBuffer::DsymbolPrettyPrintVisitor::visit(FuncDeclaration*):
   0x0000555555697410 <+0>: push   r15
   0x0000555555697412 <+2>: push   r14
   0x0000555555697414 <+4>: push   r13
   0x0000555555697416 <+6>: push   r12
   0x0000555555697418 <+8>: push   rbx
   0x0000555555697419 <+9>: mov    r14,rsi
   0x000055555569741c <+12>: mov    rbx,QWORD PTR [rdi+0x8]
   0x0000555555697420 <+16>: mov    rdi,QWORD PTR [rbx]
   0x0000555555697423 <+19>: mov    rsi,QWORD PTR [rsi+0x60]
   0x0000555555697427 <+23>: call   0x5555556950c0 <dmd.hdrgen.stcToBuffer(ref
dmd.common.outbuffer.OutBuffer, ulong)>
   0x000055555569742c <+28>: test   al,al
   0x000055555569742e <+30>: je     0x55555569743d
<toCBuffer::DsymbolPrettyPrintVisitor::visit(FuncDeclaration*)+45>
   0x0000555555697430 <+32>: mov    rdi,QWORD PTR [rbx]
   0x0000555555697433 <+35>: mov    esi,0x20
   0x0000555555697438 <+40>: call   0x555555a232f0
<OutBuffer::writeByte(unsigned int)>
   0x000055555569743d <+45>: mov    r12,QWORD PTR [r14+0x8]
   0x0000555555697441 <+49>: mov    rax,QWORD PTR [r14+0x50]
   0x0000555555697445 <+53>: xor    r15d,r15d
   0x0000555555697448 <+56>: cmp    BYTE PTR [rax+0x8],0x5
   0x000055555569744c <+60>: cmove  r15,rax
   0x0000555555697450 <+64>: mov    r13,QWORD PTR [rbx]
   0x0000555555697453 <+67>: mov    r8,QWORD PTR [rbx+0x8]
=> 0x0000555555697457 <+71>: cmp    BYTE PTR [r15+0x8],0x5
   0x000055555569745c <+76>: jne    0x555555697475
<toCBuffer::DsymbolPrettyPrintVisitor::visit(FuncDeclaration*)+101>

rax            0x7ffff79e5b10      140737347738384
rbx            0x7fffee01dcf0      140737186487536
rcx            0x6f747561          1869903201
rdx            0x4                 4
rsi            0x20                32
rdi            0x7fffffffd240      140737488343616
rbp            0x555556e58f80      0x555556e58f80
rsp            0x7fffffffce60      0x7fffffffce60
r8             0x7fffffffcf40      140737488342848
r9             0x2                 2
r10            0x0                 0
r11            0x0                 0
r12            0x7ffff738f8c0      140737341094080
r13            0x7fffffffd240      140737488343616
r14            0x7ffff10ae800      140737237411840
r15            0x0                 0                      <=== !!!
rip            0x555555697457      0x555555697457
<toCBuffer::DsymbolPrettyPrintVisitor::visit(FuncDeclaration*)+71>
eflags         0x10216             [ PF AF IF RF ]
cs             0x33                51
ss             0x2b                43
ds             0x0                 0
es             0x0                 0
fs             0x0                 0
gs             0x0                 0
fs_base        0x7ffff7c65d00      140737350360320
gs_base        0x0                 0


I'm on Arch Linux with DMD v2.107.0

I might try to provide reduced example program later at some point.

--