From: Claire Dross Date: Mon, 9 May 2022 13:44:22 +0000 (+0200) Subject: [Ada] Fix iteration on formal vectors X-Git-Tag: basepoints/gcc-14~6277 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=878043af338c3b49f7848f3b73938cfa75a97393;p=thirdparty%2Fgcc.git [Ada] Fix iteration on formal vectors 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. --- diff --git a/gcc/ada/libgnat/a-cfinve.adb b/gcc/ada/libgnat/a-cfinve.adb index 17b57cb6bc0..a55786d95d0 100644 --- a/gcc/ada/libgnat/a-cfinve.adb +++ b/gcc/ada/libgnat/a-cfinve.adb @@ -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 diff --git a/gcc/ada/libgnat/a-cfinve.ads b/gcc/ada/libgnat/a-cfinve.ads index ec6af9918e8..b5fa29bf7b1 100644 --- a/gcc/ada/libgnat/a-cfinve.ads +++ b/gcc/ada/libgnat/a-cfinve.ads @@ -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), diff --git a/gcc/ada/libgnat/a-cofove.adb b/gcc/ada/libgnat/a-cofove.adb index 5f10f57e870..c921184eb03 100644 --- a/gcc/ada/libgnat/a-cofove.adb +++ b/gcc/ada/libgnat/a-cofove.adb @@ -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 diff --git a/gcc/ada/libgnat/a-cofove.ads b/gcc/ada/libgnat/a-cofove.ads index edf95323087..cba10a63746 100644 --- a/gcc/ada/libgnat/a-cofove.ads +++ b/gcc/ada/libgnat/a-cofove.ads @@ -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),