As of LDC 1.42.0 (new regression in this version), tested on macOS 14.5 (AArch64), trying to compile a file that contains an interface like this:
interface I{
void fn() const
out(; true);
}
Causes LDC2 to segfault with a trace like this:
0 ldc2 0x00000001042c6338 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 ldc2 0x00000001042c404c llvm::sys::RunSignalHandlers() + 64
2 ldc2 0x00000001042c6e2c SignalHandler(int, __siginfo*, void*) + 356
3 libsystem_platform.dylib 0x000000018b007584 _sigtramp + 56
4 ldc2 0x00000001048379a8 ObjCState::getProtocol(InterfaceDeclaration*) + 236
5 ldc2 0x00000001048379a8 ObjCState::getProtocol(InterfaceDeclaration*) + 236
6 ldc2 0x000000010483a668 ObjCState::deref(ClassDeclaration*, llvm::Type*) + 56
7 ldc2 0x000000010480388c DtoDynamicCastInterface(Loc, DValue*, Type*) + 396
8 ldc2 0x000000010480353c DtoCastClass(Loc, DValue*, Type*) + 1160
9 ldc2 0x00000001048622bc ImplicitArgumentsBuilder::addContext(bool) + 328
10 ldc2 0x0000000104860a1c DtoCallFunction(Loc, Type*, DValue*, Array<Expression*>*, llvm::Value*, bool) + 1144
11 ldc2 0x0000000104876bf0 ToElemVisitor::call(IRState*, CallExp*, llvm::Value*) + 1076
12 ldc2 0x000000010486a5cc ToElemVisitor::visit(CallExp*) + 28
13 ldc2 0x000000010485b430 ToIRVisitor::visit(ExpStatement*) + 400
14 ldc2 0x000000010485b5ec ToIRVisitor::visit(CompoundStatement*) + 260
15 ldc2 0x0000000104855668 ToIRVisitor::visit(LabelStatement*) + 1304
16 ldc2 0x000000010485b5ec ToIRVisitor::visit(CompoundStatement*) + 260
17 ldc2 0x000000010481adc4 DtoDefineFunction(FuncDeclaration*, bool) + 5696
18 ldc2 0x000000010480a984 CodegenVisitor::visit(InterfaceDeclaration*) + 396
19 ldc2 0x000000010482bc40 codegenModule(IRState*, Module*) + 3288
20 ldc2 0x00000001048ad510 ldc::CodeGenerator::emit(Module*) + 220
21 ldc2 0x00000001048cd5d8 codegenModules(Array<Module*>&) + 944
22 ldc2 0x00000001047cecd4 mars_tryMain(Param&, Array<char const*>&) + 1684
23 ldc2 0x00000001048cc2d0 cppmain() + 6332
24 ldc2 0x00000001044babac _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv + 128
25 ldc2 0x00000001044ba8d0 _d_run_main2 + 484
26 ldc2 0x00000001044ba6d0 _d_run_main + 144
27 ldc2 0x00000001048ca9bc main + 732
28 dyld 0x000000018ac4e0e0 start + 2360
Segmentation fault: 11
Pre-conditions and post-conditions cause the same segfault. The return type, parameters of the function, and contents of the pre/post-condition seem to be irrelevant. This issue does not occur with abstract functions in a class (or functions in an abstract class). The segfault does not occur if const or the pre/post-condition are removed.
As of LDC 1.42.0 (new regression in this version), tested on macOS 14.5 (AArch64), trying to compile a file that contains an interface like this:
Causes LDC2 to segfault with a trace like this:
Pre-conditions and post-conditions cause the same segfault. The return type, parameters of the function, and contents of the pre/post-condition seem to be irrelevant. This issue does not occur with
abstractfunctions in aclass(or functions in anabstract class). The segfault does not occur ifconstor the pre/post-condition are removed.