aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-12-04 12:35:29 +0100
committerMarc Poulhiès <dkm@gcc.gnu.org>2025-01-03 16:39:12 +0100
commit4b330318626ec5907436aea8eb9c326da85f1e61 (patch)
tree75c131f52057e1062fa1195825ca835ad520b11e
parentcca7647392727038c86a9eb785cbd673896afa57 (diff)
downloadgcc-4b330318626ec5907436aea8eb9c326da85f1e61.zip
gcc-4b330318626ec5907436aea8eb9c326da85f1e61.tar.gz
gcc-4b330318626ec5907436aea8eb9c326da85f1e61.tar.bz2
ada: Fix small thinko in previous change
Even if the declaration of the conditional object is turned into a renaming during expansion, the conditional object must be finalized when the original object would have been. gcc/ada/ChangeLog: * exp_ch4.adb (Insert_Conditional_Object_Declaration): Create the Master_Node even if the declaration is turned into a renaming.
-rw-r--r--gcc/ada/exp_ch4.adb4
1 files changed, 1 insertions, 3 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 2fc891a..f44f21d 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -13240,9 +13240,7 @@ package body Exp_Ch4 is
-- cannot invoke Process_Transients_In_Expression on it since it is not
-- a transient object (it has the lifetime of the original object).
- if Nkind (Obj_Decl) = N_Object_Declaration
- and then Needs_Finalization (Base_Type (Etype (Obj_Id)))
- then
+ if Needs_Finalization (Base_Type (Etype (Obj_Id))) then
Master_Node_Id := Make_Temporary (Loc, 'N');
Master_Node_Decl :=
Make_Master_Node_Declaration (Loc, Master_Node_Id, Obj_Id);