Same testcase as in #270, but with -g or -gc thrown, causes LLVM to crash when it's trying to write debug info.
a.d:
import b;
void main() { C!().f; }
b.d:
template C() {
void f() {
int[1] x;
x[] += x[];
}
}
Compiling just ldc -c -g a.d or ldc -c -gc a.d gives:
ldc: /home/deewiant/src/llvm/src/lib/CodeGen/AsmPrinter/DwarfWriter.cpp:2147: void llvm::DwarfDebug::ConstructFunctionDbgScope(llvm::DbgScope*): Assertion `SPDie && "Missing subprogram descriptor"' failed.
0 ldc 0x0000000000d733df
1 ldc 0x0000000000d737d9
2 libpthread.so.0 0x00007f9a6c9ad920
3 libc.so.6 0x00007f9a6b8a60c5 gsignal + 53
4 libc.so.6 0x00007f9a6b8a75e3 abort + 387
5 libc.so.6 0x00007f9a6b89f0e9 __assert_fail + 233
6 ldc 0x000000000099268f
7 ldc 0x0000000000992861 llvm::DwarfDebug::EndFunction(llvm::MachineFunction*) + 465
8 ldc 0x000000000097c1ac llvm::DwarfWriter::EndFunction(llvm::MachineFunction*) + 28
9 ldc 0x0000000000695e1c
10 ldc 0x0000000000d0fbd9 llvm::FPPassManager::runOnFunction(llvm::Function&) + 489
11 ldc 0x0000000000d105be llvm::FunctionPassManagerImpl::run(llvm::Function&) + 142
12 ldc 0x0000000000d107cb llvm::FunctionPassManager::run(llvm::Function&) + 75
13 ldc 0x0000000000630e11 write_asm_to_file(llvm::TargetMachine&, llvm::Module&, llvm::raw_fd_ostream&) + 401
14 ldc 0x000000000063248e writeModule(llvm::Module*, std::string) + 510
15 ldc 0x0000000000601e84 main + 5940
16 libc.so.6 0x00007f9a6b892546 __libc_start_main + 230
17 ldc 0x000000000055cd29
Stack dump:
0. Running pass 'X86 AT&T-Style Assembly Printer' on function '@_D1b24_arraySliceSliceAddass_iFAiAiZAi'
The error is from the LLVM trunk but the failure happened also on 2.5.