https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110113
Bug ID: 110113 Summary: gdc -fpreview=dip1021 crash in d/dmd/root/aav.d:127 dmd_aaGetRvalue from DsymbolTable::lookup(Identifier const*) Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: witold.baryluk+gcc at gmail dot com Target Milestone: --- Created attachment 55254 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55254&action=edit Minimized test case with dustmite Debian Linux amd64, experimental gcc-13, gdc 13.1.0-3 This is not very deterministic. Run few times to trigger. ``` user@debian:~$ cat lup.d class LUBench { } float lup(ulong , ulong , int , int = 1) { double[] solution; new LUBench; return solution[0] ; } float lup_3200(ulong iters, ulong flops) { return lup(iters, flops, 3200); } float raytrace() { struct V { float x, y, z; auto normalize() { } import std; auto cross() { } auto norm2() { } auto norm() { } auto opBinary(){ } } } user@debian:~$ gdc-13 -c -fpreview=dip1021 lup.d lup.d:11:7: error: function ‘lup.raytrace’ has no ‘return’ statement, but is expected to return a value of type ‘float’ 11 | float raytrace() { | ^ user@debian:~$ gdc-13 -c -fpreview=dip1021 lup.d lup.d:11:7: error: function ‘lup.raytrace’ has no ‘return’ statement, but is expected to return a value of type ‘float’ 11 | float raytrace() { | ^ user@debian:~$ gdc-13 -c -fpreview=dip1021 lup.d lup.d:11:7: error: function ‘lup.raytrace’ has no ‘return’ statement, but is expected to return a value of type ‘float’ 11 | float raytrace() { | ^ user@debian:~$ gdc-13 -c -fpreview=dip1021 lup.d lup.d:11:7: error: function ‘lup.raytrace’ has no ‘return’ statement, but is expected to return a value of type ‘float’ 11 | float raytrace() { | ^ user@debian:~$ gdc-13 -c -fpreview=dip1021 lup.d /usr/lib/gcc/x86_64-linux-gnu/13/include/d/std/math/algebraic.d:968:47: internal compiler error: Segmentation fault 968 | return cast(Unqual!T) (T(1) << bsr(val) + type); | ^ 0xd32f86 crash_signal ../../src/gcc/toplev.cc:314 0x7f53b651cf8f ??? ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0x17f7d10 _D3dmd4root3aav15dmd_aaGetRvalueFNaNbNiPSQBnQBmQBk2AAPvZQd ../../src/gcc/d/dmd/root/aav.d:127 0x1706b25 DsymbolTable::lookup(Identifier const*) ../../src/gcc/d/dmd/dsymbol.d:2408 0x1706b25 ScopeDsymbol::search(Loc const&, Identifier*, int) ../../src/gcc/d/dmd/dsymbol.d:1470 0x17ef5b3 _D3dmd6opover15search_functionFCQBe7dsymbol12ScopeDsymbolCQCe10identifier10IdentifierZCQDhQCd7Dsymbol ../../src/gcc/d/dmd/opover.d:1435 0x1701fe0 search_toString(StructDeclaration*) ../../src/gcc/d/dmd/dstruct.d:51 0x180310a semanticTypeInfoMembers(StructDeclaration*) ../../src/gcc/d/dmd/semantic3.d:1650 0x1803394 Semantic3Visitor::visit(AggregateDeclaration*) ../../src/gcc/d/dmd/semantic3.d:1590 0x17fef19 semantic3(Dsymbol*, Scope*) ../../src/gcc/d/dmd/semantic3.d:83 0x175dc89 ExpressionSemanticVisitor::visit(DeclarationExp*) ../../src/gcc/d/dmd/expressionsem.d:5572 0x175dc89 ExpressionSemanticVisitor::visit(DeclarationExp*) ../../src/gcc/d/dmd/expressionsem.d:5407 0x175eb82 expressionSemantic(Expression*, Scope*) ../../src/gcc/d/dmd/expressionsem.d:12706 0x18096fa StatementSemanticVisitor::visit(ExpStatement*) ../../src/gcc/d/dmd/statementsem.d:207 0x18228c1 statementSemantic(Statement*, Scope*) ../../src/gcc/d/dmd/statementsem.d:149 0x18228c1 StatementSemanticVisitor::visit(CompoundStatement*) ../../src/gcc/d/dmd/statementsem.d:270 0x1809112 statementSemantic(Statement*, Scope*) ../../src/gcc/d/dmd/statementsem.d:149 0x18002a1 Semantic3Visitor::visit(FuncDeclaration*) ../../src/gcc/d/dmd/semantic3.d:598 0x17feae4 semantic3(Dsymbol*, Scope*) ../../src/gcc/d/dmd/semantic3.d:83 0x17feae4 Semantic3Visitor::visit(Module*) ../../src/gcc/d/dmd/semantic3.d:205 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-13/README.Bugs> for instructions. user@debian:~$ ``` Could not reduce further, as it is sensitive to identifiers, and due to non-deterministic nature testing requires many repetitions.