From: Viljar Indus Date: Wed, 5 Jul 2023 09:28:56 +0000 (+0300) Subject: ada: Fix expanding container aggregates with Iterator specification X-Git-Tag: basepoints/gcc-15~7526 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6ca70c6744ed6019b1ddbc41c8a09a45331e5bb;p=thirdparty%2Fgcc.git ada: Fix expanding container aggregates with Iterator specification The compiler should use unnamed addition methods such as Append when expanding a container aggregate with Iterator Specification. gcc/ada/ * exp_aggr.adb (Expand_Container_Aggregate): Use the positional addition method only when dealing with a container aggregate without an Iterator Specification e.g. with a loop parameter specification --- diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 4c8dcae9d83f..dffc5ab721db 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -7259,8 +7259,11 @@ package body Exp_Aggr is -- Iterated component association. Discard -- positional insertion procedure. - Add_Named_Subp := Assign_Indexed_Subp; - Add_Unnamed_Subp := Empty; + if not Present (Iterator_Specification (Comp)) then + Add_Named_Subp := Assign_Indexed_Subp; + Add_Unnamed_Subp := Empty; + end if; + Expand_Iterated_Component (Comp); end if;