From: Piotr Trojanek Date: Mon, 3 Aug 2020 20:54:18 +0000 (+0200) Subject: [Ada] Fix crash with iterated_component_association and -gnatc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3b612313b6e67dd01159cd8ceeafeac9f9e6dd04;p=gcc.git [Ada] Fix crash with iterated_component_association and -gnatc gcc/ada/ * sem_aggr.adb (Resolve_Iterated_Component_Association): Expression's copy and now has the same parent as the original expression. (Resolve_Array_Aggregate): Add ??? comment about a still existing minor issue that led to discovery of the above crash. --- diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index c7d1e49d91e..7587295323d 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -1662,6 +1662,7 @@ package body Sem_Aggr is -- as a loop with a new index variable. Expr := New_Copy_Tree (Expression (N)); + Set_Parent (Expr, N); Dummy := Resolve_Aggr_Expr (Expr, False); -- An iterated_component_association may appear in a nested @@ -2057,8 +2058,13 @@ package body Sem_Aggr is return Failure; end if; + -- ??? Checks for dynamically tagged expressions below will + -- be only applied to iterated_component_association after + -- expansion; in particular, errors might not be reported when + -- -gnatc switch is used. + elsif Nkind (Assoc) = N_Iterated_Component_Association then - null; -- handled above, in a loop context. + null; -- handled above, in a loop context elsif not Resolve_Aggr_Expr (Expression (Assoc), Single_Elmt => Single_Choice)