ldc
ldc copied to clipboard
SIGSEGV during compilation
linux 6.0.7, LLVM D compiler (1.30.0)
code to reproduce (no small sample) : git clone https://git.code.sf.net/p/vs4/code vs4 cd vs4 meson setup --native-file ldc.ini Builddir cd Builddir ninja
SIGSEGV while compiling mm/block.d
DMD64 D Compiler v2.101.1 and gdc (GCC) 12.2.0 has the same problem.
debugger session
lldb /m/root/ldc2-1.30.0-linux-x86_64/bin/ldc2
(lldb) target create "/m/root/ldc2-1.30.0-linux-x86_64/bin/ldc2"
Current executable set to '/m/root/ldc2-1.30.0-linux-x86_64/bin/ldc2' (x86_64).
(lldb) r -I=libvs4.a.p -I=. -I=.. -I=grammar -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/dmd/phobos -I/m/sw/dzrec -I/m/sw/dzrec/grammar -I/m/sw/dzrec/tree -I/m/sw/dzrec/mm -I/m/sw/dzrec/tools -I/m/sw/dzrec/G -I/m/sw/dzrec/G/grammar -wi -enable-inlining -Hkeep-all-bodies -O2 -g -d-debug --dwarf-version=1 -mcpu=native -preview=shortenedMethods -relocation-model=pic -makedeps=libvs4.a.p/mm_block.d.o.deps -of=libvs4.a.p/mm_block.d.o -c ../mm/block.d
Process 7634 launched: '/m/root/ldc2-1.30.0-linux-x86_64/bin/ldc2' (x86_64)
Process 7634 stopped
* thread #1, name = 'ldc2', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x00000000056d6865 ldc2`ExpressionSemanticVisitor::visit(NewExp*) + 2133
ldc2`ExpressionSemanticVisitor::visit:
-> 0x56d6865 <+2133>: movq (%rax), %rax
0x56d6868 <+2136>: movq %rbp, %rdi
0x56d686b <+2139>: callq *0x238(%rax)
0x56d6871 <+2145>: testq %rax, %rax
(lldb) bt
* thread #1, name = 'ldc2', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
* frame #0: 0x00000000056d6865 ldc2`ExpressionSemanticVisitor::visit(NewExp*) + 2133
frame #1: 0x00000000055325ab ldc2`ExpressionSemanticVisitor::visit(AssignExp*) + 683
frame #2: 0x00000000055f9903 ldc2`StatementSemanticVisitor::visit(CompoundStatement*) + 1779
frame #3: 0x0000000005722bad ldc2`Semantic3Visitor::visit(FuncDeclaration*) + 10525
frame #4: 0x00000000057393ad ldc2`Semantic3Visitor::visit(AggregateDeclaration*) + 157
frame #5: 0x000000000571fd27 ldc2`Semantic3Visitor::visit(Module*) + 183
frame #6: 0x00000000054146d7 ldc2`SemanticTimeTraceVisitor<Semantic3Visitor*>::visit(Module*) + 55
frame #7: 0x00000000057b8251 ldc2`mars_mainBody(Param&, Array<char const*>&, Array<char const*>&) + 1489
frame #8: 0x00000000058fbb84 ldc2`cppmain() + 8196
(lldb)
DMD64 D Compiler v2.101.1 and gdc (GCC) 12.2.0 has the same problem.
Yes this is a frontend problem, https://issues.dlang.org/show_bug.cgi?id=23564
The upstream fix landed in v2.101.2, so should have landed in master here too by now.