https://gcc.gnu.org/g:d9d35f1cb6de2053337af3b5c39747f5ef066eae
commit r17-1191-gd9d35f1cb6de2053337af3b5c39747f5ef066eae Author: Viljar Indus <[email protected]> Date: Tue Apr 14 16:38:13 2026 +0300 ada: Avoid referencing ignored ghost nodes in finalizer gcc/ada/ChangeLog: * exp_ch7.adb (Processing_Actions): Avoid processing ignored ghost declarations. Diff: --- gcc/ada/exp_ch7.adb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 292327c67c51..f4f30dcc85d4 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -2430,6 +2430,14 @@ package body Exp_Ch7 is Strict : Boolean := False) is begin + -- No need to process ignored ghost declarations as they will be + -- removed later and therefore do not need finalization + -- primitives. + + if Is_Ignored_Ghost_Node (Decl) then + return; + end if; + -- Library-level tagged type if Nkind (Decl) = N_Full_Type_Declaration then
