From: Eric Botcazou <ebotca...@adacore.com> It dates back to when analysis was performed on a copy of the expression.
gcc/ada/ChangeLog: * sem_aggr.adb (Resolve_Iterated_Component_Association): Move up declaration of Expr and remove dead code from older processing. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_aggr.adb | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 63e17f480a4..9439d649f2a 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -2114,8 +2114,9 @@ package body Sem_Aggr is (N : Node_Id; Index_Typ : Entity_Id) is - Loc : constant Source_Ptr := Sloc (N); - Id : constant Entity_Id := Defining_Identifier (N); + Loc : constant Source_Ptr := Sloc (N); + Id : constant Entity_Id := Defining_Identifier (N); + Expr : constant Node_Id := Expression (N); ----------------------- -- Remove_References -- @@ -2145,7 +2146,6 @@ package body Sem_Aggr is Choice : Node_Id; Resolution_OK : Boolean; Scop : Entity_Id; - Expr : constant Node_Id := Expression (N); -- Start of processing for Resolve_Iterated_Component_Association @@ -2234,16 +2234,6 @@ package body Sem_Aggr is end; end if; - -- An iterated_component_association may appear in a nested - -- aggregate for a multidimensional structure: preserve the bounds - -- computed for the expression, as well as the anonymous array - -- type generated for it; both are needed during array expansion. - - if Nkind (Expr) = N_Aggregate then - Set_Aggregate_Bounds (Expression (N), Aggregate_Bounds (Expr)); - Set_Etype (Expression (N), Etype (Expr)); - end if; - End_Scope; end Resolve_Iterated_Component_Association; -- 2.43.0