aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_aggr.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/exp_aggr.adb')
-rw-r--r--gcc/ada/exp_aggr.adb11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 40dd1c4..f3ad8a9 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -9840,6 +9840,7 @@ package body Exp_Aggr is
Res_Decl : Node_Id;
Res_Id : Entity_Id;
Res_Typ : Entity_Id;
+ Copy_Init_Expr : constant Node_Id := New_Copy_Tree (Init_Expr);
-- Start of processing for Process_Transient_Component
@@ -9890,7 +9891,15 @@ package body Exp_Aggr is
Constant_Present => True,
Object_Definition => New_Occurrence_Of (Res_Typ, Loc),
Expression =>
- Make_Reference (Loc, New_Copy_Tree (Init_Expr)));
+ Make_Reference (Loc, Copy_Init_Expr));
+
+ -- In some cases, like iterated component, the Init_Expr may have been
+ -- analyzed in a context where all the Etype fields are not correct yet
+ -- and a later call to Analyze is expected to set them.
+ -- Resetting the Analyzed flag ensures this later call doesn't skip this
+ -- node.
+
+ Reset_Analyzed_Flags (Copy_Init_Expr);
Add_Item (Res_Decl);