]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix expanding container aggregates with Iterator specification
authorViljar Indus <indus@adacore.com>
Wed, 5 Jul 2023 09:28:56 +0000 (12:28 +0300)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 18 Jul 2023 13:11:47 +0000 (15:11 +0200)
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

gcc/ada/exp_aggr.adb

index 4c8dcae9d83ff08ec130793a189905719735892c..dffc5ab721dbc64555d2c3ec364636d52fe077f3 100644 (file)
@@ -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;