From: Eric Botcazou <[email protected]>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
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 905094c7e40..1c569b90dd2 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.
--
2.43.0