From: Eric Botcazou Date: Wed, 6 Sep 2023 07:37:29 +0000 (+0200) Subject: ada: Fix internal error on aggregate nested in container aggregate X-Git-Tag: releases/gcc-12.5.0~378 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c7c99f95661db80b6e1b52c10c34e9ce9c5eb6a;p=thirdparty%2Fgcc.git ada: Fix internal error on aggregate nested in container aggregate This handles the case where a component association is present. gcc/ada/ PR ada/118234 * 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. --- diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index cda5e66943ec..479db647f3cc 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -4933,9 +4933,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) @@ -6799,10 +6801,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 (Parent_Kind = N_Assignment_Statement