aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/exp_aggr.adb27
1 files changed, 9 insertions, 18 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 1dcbfad..a6a7d81 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -1422,24 +1422,6 @@ package body Exp_Aggr is
Expression => New_Copy_Tree (Init_Expr));
Set_No_Ctrl_Actions (Init_Stmt);
- -- If this is an aggregate for an array of arrays, each
- -- subaggregate will be expanded as well, and even with
- -- No_Ctrl_Actions the assignments of inner components will
- -- require attachment in their assignments to temporaries. These
- -- temporaries must be finalized for each subaggregate. Generate:
-
- -- begin
- -- Arr_Comp := Init_Expr;
- -- end;
-
- if Finalization_OK and then Is_Array_Type (Comp_Typ) then
- Init_Stmt :=
- Make_Block_Statement (Loc,
- Handled_Statement_Sequence =>
- Make_Handled_Sequence_Of_Statements (Loc,
- Statements => New_List (Init_Stmt)));
- end if;
-
Append_To (Blk_Stmts, Init_Stmt);
-- Adjust the tag due to a possible view conversion. Generate:
@@ -7072,6 +7054,15 @@ package body Exp_Aggr is
and then Parent_Kind = N_Allocator
then
Establish_Transient_Scope (N, Manage_Sec_Stack => False);
+
+ -- If the parent is an assignment for which no controlled actions
+ -- should take place, prevent the temporary from being finalized.
+
+ elsif Parent_Kind = N_Assignment_Statement
+ and then No_Ctrl_Actions (Parent_Node)
+ then
+ Mutate_Ekind (Tmp, E_Variable);
+ Set_Is_Ignored_Transient (Tmp);
end if;
Insert_Action (N, Tmp_Decl);