X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gcc%2Fada%2Fsem_aggr.adb;h=3f96139e3225d2789101f3b73426301309ab8102;hb=02fb12801b18c9d3cfe1c29b5be9f33d2dc77e21;hp=90ddee27afda86255c5e78970e9db39ae1172cd5;hpb=fb00cc7032bf1129373edd2bd99cf02fe03fd1d8;p=gcc.git diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 90ddee27afd..3f96139e322 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -1680,18 +1680,21 @@ package body Sem_Aggr is Set_Ekind (Id, E_Variable); Set_Scope (Id, Ent); - -- Analyze the expression without expansion, to verify legality. - -- After analysis we remove references to the index variable because - -- the expression will be analyzed anew when the enclosing aggregate - -- is expanded, and the construct is rewritten as a loop with a new - -- index variable. + -- Analyze expression without expansion, to verify legality. + -- When generating code, we then remove references to the index + -- variable, because the expression will be analyzed anew after + -- rewritting as a loop with a new index variable; when not + -- generating code we leave the analyzed expression as it is. Expr := Expression (N); Expander_Mode_Save_And_Set (False); Dummy := Resolve_Aggr_Expr (Expr, Single_Elmt => False); Expander_Mode_Restore; - Remove_References (Expr); + + if Operating_Mode /= Check_Semantics then + Remove_References (Expr); + end if; -- An iterated_component_association may appear in a nested -- aggregate for a multidimensional structure: preserve the bounds