diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-04-23 19:54:32 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-06-13 15:30:28 +0200 |
commit | 916a0f026e1516de4608b308cd7e4b68b8e562bb (patch) | |
tree | 855d913b2a903f55de53a97be46d777b0c4b2d3a | |
parent | 50ffb636ca0553825fa4693f9b6759683a35f94a (diff) | |
download | gcc-916a0f026e1516de4608b308cd7e4b68b8e562bb.zip gcc-916a0f026e1516de4608b308cd7e4b68b8e562bb.tar.gz gcc-916a0f026e1516de4608b308cd7e4b68b8e562bb.tar.bz2 |
ada: Fix fallout of previous finalization change
Now that Is_Finalizable_Transient only looks at the renamings coming from
nontransient objects serviced by transient scopes, it must find the object
ultimately renamed by them through a chain of renamings.
gcc/ada/
PR ada/114710
* exp_util.adb (Find_Renamed_Object): Recurse if the renamed object
is itself a renaming.
-rw-r--r-- | gcc/ada/exp_util.adb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 6ad464e..bf95b0e1 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -8808,9 +8808,10 @@ package body Exp_Util is First_Stmt : Node_Id) return Boolean is function Find_Renamed_Object (Ren_Decl : Node_Id) return Entity_Id; - -- Given an object renaming declaration, retrieve the entity of the - -- renamed name. Return Empty if the renamed name is anything other - -- than a variable or a constant. + -- Given an object renaming declaration, retrieve the entity within + -- the renamed name, recursively if this entity is itself a renaming. + -- Return Empty if the renamed name contains anything other than a + -- variable or a constant. ------------------------- -- Find_Renamed_Object -- @@ -8877,7 +8878,16 @@ package body Exp_Util is Search (Constant_Value (Ren_Obj)); end if; - return Ren_Obj; + -- Recurse if Ren_Obj is itself a renaming + + if Present (Ren_Obj) + and then Ekind (Ren_Obj) = E_Variable + and then Present (Renamed_Object (Ren_Obj)) + then + return Find_Renamed_Object (Declaration_Node (Ren_Obj)); + else + return Ren_Obj; + end if; end Find_Renamed_Object; -- Local variables |