https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116373
Bug ID: 116373 Summary: [14/15 regression] ICE in dmd.expressionsem.resolveLoc since f204359931866b917856fc959c70dbf55f28c14d Product: gcc Version: 14.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: a.horodniceanu at proton dot me Target Milestone: --- The following code produces an ICE beginning with commit f204359931866b917856fc959c70dbf55f28c14d: ---- int[] x; void foo (int[] y = x[]) {} void main () { foo(); } ---- The error is: --- $ /usr/x86_64-pc-linux-gnu/gcc-bin/14/gdc /tmp/repro.d -freport-bug d21: internal compiler error: Segmentation fault 0x5620a9cbfb94 internal_error(char const*, ...) ???:0 0x5620a83fef9a _D3dmd13expressionsem10resolveLocFCQBh10expression10ExpressionKxSQCl8location3LocPSQDd6dscope5ScopeZQCo ???:0 0x5620a83ff386 _D3dmd13expressionsem10resolveLocFCQBh10expression10ExpressionKxSQCl8location3LocPSQDd6dscope5ScopeZQCo ???:0 0x5620a8410b07 _D3dmd13expressionsem18functionParametersFKxSQBr8location3LocPSQCj6dscope5ScopeCQDa5mtype12TypeFunctionCQDy10expression10ExpressionCQFaQCa4TypeSQFmQBo12ArgumentListCQGh4func15FuncDeclarationPQCiPQDoZb ???:0 0x5620a841edff ExpressionSemanticVisitor::visit(CallExp*) ???:0 0x5620a83f9d43 _D3dmd13expressionsem18expressionSemanticFCQBp10expression10ExpressionPSQCs6dscope5ScopeZQBv ???:0 0x5620a84dd84b _D3dmd12statementsem17statementSemanticFCQBn9statement9StatementPSQCm6dscope5ScopeZQBr ???:0 0x5620a84b8b08 Semantic3Visitor::visit(FuncDeclaration*) ???:0 0x5620a84b6a0f Semantic3Visitor::visit(Module*) ???:0 0x5620a84b6f9a _D3dmd9semantic3QkFCQs7dsymbol7DsymbolPSQBm6dscope5ScopeZv ???:0 Please submit a full bug report, with preprocessed source. Please include the complete backtrace with any bug report. See <https://bugs.gentoo.org/> for instructions. --- The demangled output: ---- d21: internal compiler error: Segmentation fault 0x56495f42ab94 internal_error(char const*, ...) ???:0 0x56495db69f9a dmd.expressionsem.resolveLoc(dmd.expression.Expression, ref const(dmd.location.Loc), dmd.dscope.Scope*) ???:0 0x56495db6a386 dmd.expressionsem.resolveLoc(dmd.expression.Expression, ref const(dmd.location.Loc), dmd.dscope.Scope*) ???:0 0x56495db7bb07 dmd.expressionsem.functionParameters(ref const(dmd.location.Loc), dmd.dscope.Scope*, dmd.mtype.TypeFunction, dmd.expression.Expression, dmd.mtype.Type, dmd.expression.ArgumentList, dmd.func.FuncDeclaration, dmd.mtype.Type*, dmd.expression.Expression*) ???:0 0x56495db89dff ExpressionSemanticVisitor::visit(CallExp*) ???:0 0x56495db64d43 dmd.expressionsem.expressionSemantic(dmd.expression.Expression, dmd.dscope.Scope*) ???:0 0x56495dc4884b dmd.statementsem.statementSemantic(dmd.statement.Statement, dmd.dscope.Scope*) ???:0 0x56495dc23b08 Semantic3Visitor::visit(FuncDeclaration*) ???:0 0x56495dc21a0f Semantic3Visitor::visit(Module*) ???:0 0x56495dc21f9a dmd.semantic3.semantic3(dmd.dsymbol.Dsymbol, dmd.dscope.Scope*) ???:0 Please submit a full bug report, with preprocessed source. Please include the complete backtrace with any bug report. See <https://bugs.gentoo.org/> for instructions. ---- I've used the following gcc version to get the trace: ---- gdc (Gentoo Hardened 14.2.1_p20240803 p4) 14.2.1 20240803 Copyright (C) 2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ---- I've initially got the error trying to compile https://github.com/CyberShadow/btdu which depends on https://github.com/CyberShadow/d-btrfs which contains such a default function argument expression.