ldc icon indicating copy to clipboard operation
ldc copied to clipboard

Compiler crash?

Open jordan4ibanez opened this issue 9 months ago • 5 comments

Here is the sample code:

struct Vec3i {
    int x = 0;
    int y = 0;
    int z = 0;
}

private static void[0][Vec3i] wideBandPoints;

void blah() {
    Vec3i cache;
    wideBandPoints[cache] = null;
}

Here is the output:

 #0 0x0000582596ef90e7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x71ea0e7)
 #1 0x0000582596ef6eec llvm::sys::RunSignalHandlers() ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x71e7eec)
 #2 0x0000582596ef978f SignalHandler(int) Signals.cpp:0:0
 #3 0x00007929ba245330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #4 0x0000582593791cc2 _D3dmd5dcast14implicitConvToFCQBc5mtype4TypeQpZEQBu8astenums5MATCH ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3a82cc2)
 #5 0x00005825939e201d ExpressionSemanticVisitor::visit(AssignExp*) ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3cd301d)
 #6 0x00005825937b2d78 _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ8visitExpMFCQDuQCc12ExpStatementZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3aa3d78)
 #7 0x00005825937aed57 _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ5visit14VisitStatementMFQCpZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3a9fd57)
 #8 0x00005825937af17c _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ5visit14VisitStatementMFQCpZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3aa017c)
 #9 0x00005825937abb72 _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ7visitIfMFCQDtQCb11IfStatementZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3a9cb72)
#10 0x00005825937aed57 _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ5visit14VisitStatementMFQCpZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3a9fd57)
#11 0x00005825937af17c _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ5visit14VisitStatementMFQCpZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3aa017c)
#12 0x00005825937addd4 _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ8visitForMFCQDuQCc12ForStatementZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3a9edd4)
#13 0x00005825937aed57 _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ5visit14VisitStatementMFQCpZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3a9fd57)
#14 0x00005825937af17c _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ5visit14VisitStatementMFQCpZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3aa017c)
#15 0x00005825937adfb3 _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ8visitForMFCQDuQCc12ForStatementZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3a9efb3)
#16 0x00005825937aed57 _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ5visit14VisitStatementMFQCpZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3a9fd57)
#17 0x00005825937af17c _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ5visit14VisitStatementMFQCpZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3aa017c)
#18 0x00005825937addd4 _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ8visitForMFCQDuQCc12ForStatementZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3a9edd4)
#19 0x0000582593978e07 _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ10visitWhileMFCQDxQCf14WhileStatementZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3c69e07)
#20 0x00005825937aed57 _D3dmd12statementsem22statementSemanticVisitFCQBs9statement9StatementPSQCr6dscope5ScopeZ5visit14VisitStatementMFQCpZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3a9fd57)
#21 0x00005825938f29c9 Semantic3Visitor::visit(FuncDeclaration*) ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3be39c9)
#22 0x00005825938f01c5 SemanticTimeTraceVisitor<Semantic3Visitor*>::visit(FuncDeclaration*) ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3be11c5)
#23 0x0000582593838c6c Semantic3Visitor::visit(Module*) ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3b29c6c)
#24 0x000058259385f221 SemanticTimeTraceVisitor<Semantic3Visitor*>::visit(Module*) ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3b50221)
#25 0x0000582593a336cb mars_tryMain(Param&, Array<char const*>&) ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3d246cb)
#26 0x0000582593a80bc0 cppmain() ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3d71bc0)
#27 0x0000582597424aed _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x7715aed)
#28 0x00005825974248c4 _d_run_main2 ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x77158c4)
#29 0x00005825974246dd _d_run_main ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x77156dd)
#30 0x0000582597264fc8 main ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x7555fc8)
#31 0x00007929ba22a1ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#32 0x00007929ba22a28b call_init ./csu/../csu/libc-start.c:128:20
#33 0x00007929ba22a28b __libc_start_main ./csu/../csu/libc-start.c:347:5
#34 0x0000582593a8578e _start ($HOME/dlang/ldc-1.40.0/bin/ldc2+0x3d7678e)

jordan4ibanez avatar Feb 23 '25 05:02 jordan4ibanez

This looks like a DMD failure, not specific to LDC. What (DMD frontend) version of LDC are you using? Does the crash also occur with DMD for the same version?

thewilsonator avatar Feb 23 '25 08:02 thewilsonator

I am using

LDC - the LLVM D compiler (1.40.0):
  based on DMD v2.110.0 and LLVM 19.1.3
  built with LDC - the LLVM D compiler (1.40.0)
  Default target: x86_64-unknown-linux-gnu
  Host CPU: znver5
  http://dlang.org - http://wiki.dlang.org/LDC

jordan4ibanez avatar Feb 25 '25 12:02 jordan4ibanez

and does it fail with DMD v2.110.0?

thewilsonator avatar Feb 25 '25 13:02 thewilsonator

There is no v2.110.0 final yet, so we get more upstream issues filed here for LDC. The compiler crashes with dmd-nightly on run.dlang.io too. Apparently caused by = null; = void[0].init fixes it.

[This is the 2nd time I recently see a void[0] as AA value type - I guess someone posted this as uber-1337 trick, in the hopes of saving some memory compared to using a bool, the usual workaround for no unordered_set support in Phobos.]

kinke avatar Feb 25 '25 14:02 kinke

I have a similar error as @jordan4ibanez, with the same frontend:

LDC - the LLVM D compiler (1.40.1):
  based on DMD v2.110.0 and LLVM 19.1.7
  built with LDC - the LLVM D compiler (1.40.1)
  Default target: x86_64-pc-windows-msvc
  Host CPU: alderlake
  http://dlang.org - http://wiki.dlang.org/LDC

Clouud9 avatar May 27 '25 22:05 Clouud9