https://gcc.gnu.org/g:36332b84ce1ce738883fad68f0de4f9e678ee5f8
commit r15-9878-g36332b84ce1ce738883fad68f0de4f9e678ee5f8 Author: Eric Botcazou <ebotca...@adacore.com> Date: Mon Apr 14 10:23:52 2025 +0200 ada: Fix internal error on Ghost aspect applied to Big_Integers That's a regression introduced by the rewrite of the finalization machinery, in the form of dangling references to Master_Node entities remaining in the tree after the removal of the ignored Ghost code. gcc/ada/ChangeLog: * exp_ch7.adb (Process_Transient_In_Scope): Bail out if the object is an ignored ghost entity. Diff: --- gcc/ada/exp_ch7.adb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 905094c7e404..1c569b90dd2a 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -5275,6 +5275,13 @@ package body Exp_Ch7 is Obj_Typ : Entity_Id; begin + -- Ignored Ghost objects do not need any cleanup actions because + -- they will not appear in the final tree. + + if Is_Ignored_Ghost_Entity (Obj_Id) then + return; + end if; + -- If the object needs to be exported to the outer finalizer, -- create the declaration of the Master_Node for the object, -- which will later be picked up by Build_Finalizer.