]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix small thinko in previous change to two-pass aggregate expansion
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 13 Dec 2024 19:50:44 +0000 (20:50 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Mon, 6 Jan 2025 11:24:02 +0000 (12:24 +0100)
We need a type tailored to the base index type to compute the length.

gcc/ada/ChangeLog:

* exp_aggr.adb (Two_Pass_Aggregate_Expansion): Use the base type of
the index type to find the type used to compute the length.

gcc/ada/exp_aggr.adb

index 26b279701e9f3d1c225421fe90fc821a2366739a..b74267b299c72f1838600a54acf239c02503b952 100644 (file)
@@ -5704,10 +5704,11 @@ package body Exp_Aggr is
          Comp_Type  : constant Entity_Id := Etype (N);
          Index_Id   : constant Entity_Id := Make_Temporary (Loc, 'I', N);
          Index_Type : constant Entity_Id := Etype (First_Index (Etype (N)));
+         Index_Base : constant Entity_Id := Base_Type (Index_Type);
          Size_Id    : constant Entity_Id := Make_Temporary (Loc, 'I', N);
          Size_Type  : constant Entity_Id :=
                         Integer_Type_For
-                          (Esize (Index_Type), Is_Unsigned_Type (Index_Type));
+                          (Esize (Index_Base), Is_Unsigned_Type (Index_Base));
          TmpE       : constant Entity_Id := Make_Temporary (Loc, 'A', N);
 
          Assoc    : Node_Id := First (Component_Associations (N));