]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Fix iteration on formal vectors
authorClaire Dross <dross@adacore.com>
Mon, 9 May 2022 13:44:22 +0000 (15:44 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 2 Jun 2022 09:06:37 +0000 (09:06 +0000)
We need to use Extended_Index for the Position parameter of the Element
function in formal vectors so it is compatible with other primitives of
the Iterable aspect.

gcc/ada/

* libgnat/a-cfinve.ads (Element): Change the type of the
Position parameter to Extended_Index.
* libgnat/a-cfinve.adb (Element): Idem.
* libgnat/a-cofove.ads (Element): Idem.
* libgnat/a-cofove.adb (Element): Idem.

gcc/ada/libgnat/a-cfinve.adb
gcc/ada/libgnat/a-cfinve.ads
gcc/ada/libgnat/a-cofove.adb
gcc/ada/libgnat/a-cofove.ads

index 17b57cb6bc0a13be20def7c334177f327d491d05..a55786d95d0b86d323c914e32b4166f533331460 100644 (file)
@@ -432,7 +432,7 @@ is
 
    function Element
      (Container : Vector;
-      Index     : Index_Type) return Element_Type
+      Index     : Extended_Index) return Element_Type
    is
    begin
       if Index > Container.Last then
index ec6af9918e858db25b99e161b828ee68843c337a..b5fa29bf7b1777b547258b7439b4a964b2833705 100644 (file)
@@ -284,7 +284,7 @@ is
 
    function Element
      (Container : Vector;
-      Index     : Index_Type) return Element_Type
+      Index     : Extended_Index) return Element_Type
    with
      Global => null,
      Pre    => Index in First_Index (Container) .. Last_Index (Container),
index 5f10f57e870760be8970b73c3c499522bd97c2c9..c921184eb0347e11e30a7bfac3730bb7ad1b78b1 100644 (file)
@@ -370,7 +370,7 @@ is
 
    function Element
      (Container : Vector;
-      Index     : Index_Type) return Element_Type
+      Index     : Extended_Index) return Element_Type
    is
    begin
       if Index > Container.Last then
index edf9532308768cc9effe74f60e962d1ca1b7f4cb..cba10a637464f08d2767f2e9e36506233cd9cf45 100644 (file)
@@ -263,7 +263,7 @@ is
 
    function Element
      (Container : Vector;
-      Index     : Index_Type) return Element_Type
+      Index     : Extended_Index) return Element_Type
    with
      Global => null,
      Pre    => Index in First_Index (Container) .. Last_Index (Container),