diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-09-06 09:37:29 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-09-15 15:01:30 +0200 |
commit | ab246c16eeb82a9ba21be464eacc7c2aaca5f60c (patch) | |
tree | f5085c786d179ab75d671dca42d20186c2b942e4 /gcc/ada | |
parent | ee88062cc78245a5e00104889fb126d11992f583 (diff) | |
download | gcc-ab246c16eeb82a9ba21be464eacc7c2aaca5f60c.zip gcc-ab246c16eeb82a9ba21be464eacc7c2aaca5f60c.tar.gz gcc-ab246c16eeb82a9ba21be464eacc7c2aaca5f60c.tar.bz2 |
ada: Fix internal error on aggregate nested in container aggregate
This handles the case where a component association is present.
gcc/ada/
* exp_aggr.adb (Convert_To_Assignments): In the case of a
component association, call Is_Container_Aggregate on the parent's
parent.
(Expand_Array_Aggregate): Likewise.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/exp_aggr.adb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index cdca24b..d72e270 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -4251,9 +4251,11 @@ package body Exp_Aggr is -- excluding container aggregates as these are transformed into -- subprogram calls later. - (Parent_Kind in - N_Component_Association | N_Aggregate | N_Extension_Aggregate - and then not Is_Container_Aggregate (Parent_Node)) + (Parent_Kind = N_Component_Association + and then not Is_Container_Aggregate (Parent (Parent_Node))) + + or else (Parent_Kind in N_Aggregate | N_Extension_Aggregate + and then not Is_Container_Aggregate (Parent_Node)) -- Allocator (see Convert_Aggr_In_Allocator) @@ -6122,10 +6124,10 @@ package body Exp_Aggr is Parent_Kind := Nkind (Parent_Node); end if; - if ((Parent_Kind = N_Component_Association - or else Parent_Kind = N_Aggregate - or else Parent_Kind = N_Extension_Aggregate) - and then not Is_Container_Aggregate (Parent_Node)) + if (Parent_Kind = N_Component_Association + and then not Is_Container_Aggregate (Parent (Parent_Node))) + or else (Parent_Kind in N_Aggregate | N_Extension_Aggregate + and then not Is_Container_Aggregate (Parent_Node)) or else (Parent_Kind = N_Object_Declaration and then (Needs_Finalization (Typ) or else Is_Special_Return_Object |