From dfa6d55af715a2b902d6ed30f2c0276b1709dd5b Mon Sep 17 00:00:00 2001 From: Claire Dross Date: Tue, 13 Aug 2019 08:06:12 +0000 Subject: [PATCH] [Ada] Extend range type in search primitives of formal vectors 2019-08-13 Claire Dross gcc/ada/ * libgnat/a-cfinve.adb, libgnat/a-cofove.adb (Find_Index, Reverse_Find_Index): Use bigger type to avoid range check failure at the last loop iteration. From-SVN: r274331 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/libgnat/a-cfinve.adb | 4 ++-- gcc/ada/libgnat/a-cofove.adb | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e603f04da00..892cbbf85e6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-08-13 Claire Dross + + * libgnat/a-cfinve.adb, libgnat/a-cofove.adb (Find_Index, + Reverse_Find_Index): Use bigger type to avoid range check + failure at the last loop iteration. + 2019-08-12 Dmitriy Anisimkov * libgnat/g-socket.adb (Is_IPv6_Address): Check that no less diff --git a/gcc/ada/libgnat/a-cfinve.adb b/gcc/ada/libgnat/a-cfinve.adb index 36df8e6c1f1..a1871280dde 100644 --- a/gcc/ada/libgnat/a-cfinve.adb +++ b/gcc/ada/libgnat/a-cfinve.adb @@ -457,7 +457,7 @@ is Item : Element_Type; Index : Index_Type := Index_Type'First) return Extended_Index is - K : Capacity_Range; + K : Count_Type; Last : constant Index_Type := Last_Index (Container); begin @@ -1277,7 +1277,7 @@ is Index : Index_Type := Index_Type'Last) return Extended_Index is Last : Index_Type'Base; - K : Capacity_Range; + K : Count_Type'Base; begin if Index > Last_Index (Container) then diff --git a/gcc/ada/libgnat/a-cofove.adb b/gcc/ada/libgnat/a-cofove.adb index c848ad83990..3a10d322874 100644 --- a/gcc/ada/libgnat/a-cofove.adb +++ b/gcc/ada/libgnat/a-cofove.adb @@ -378,7 +378,7 @@ is Item : Element_Type; Index : Index_Type := Index_Type'First) return Extended_Index is - K : Capacity_Range; + K : Count_Type; Last : constant Index_Type := Last_Index (Container); begin @@ -1147,7 +1147,7 @@ is Index : Index_Type := Index_Type'Last) return Extended_Index is Last : Index_Type'Base; - K : Capacity_Range; + K : Count_Type'Base; begin if Index > Last_Index (Container) then