diff options
author | Bob Duff <duff@adacore.com> | 2019-08-12 09:01:20 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-08-12 09:01:20 +0000 |
commit | 39571eeaeb6e993f259cc603c64d5483be5afc65 (patch) | |
tree | 88c4a9c1c414fde1ac9d52d6f4d2cfa06ceb05e4 /gcc | |
parent | 18ba4b0dbd971fc879c8db3cbe50726c8bd7c25e (diff) | |
download | gcc-39571eeaeb6e993f259cc603c64d5483be5afc65.zip gcc-39571eeaeb6e993f259cc603c64d5483be5afc65.tar.gz gcc-39571eeaeb6e993f259cc603c64d5483be5afc65.tar.bz2 |
[Ada] Prevent crash in Is_Reachable
This patch fixes a bug in Is_Reachable, which causes a crash when checks
are on.
2019-08-12 Bob Duff <duff@adacore.com>
gcc/ada/
* libgnat/a-cbmutr.adb (Is_Reachable): Declare Idx to be of the
base subtype. Clearly it makes no sense to loop "while Idx >=
0", if Idx is of a nonnegative subtype.
From-SVN: r274301
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/libgnat/a-cbmutr.adb | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 97f3141..4922e46 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,11 @@ 2019-08-12 Bob Duff <duff@adacore.com> + * libgnat/a-cbmutr.adb (Is_Reachable): Declare Idx to be of the + base subtype. Clearly it makes no sense to loop "while Idx >= + 0", if Idx is of a nonnegative subtype. + +2019-08-12 Bob Duff <duff@adacore.com> + * libgnat/a-tifiio.adb (Put_Scaled): Prevent AA from being negative, since Field is range 0 .. something. diff --git a/gcc/ada/libgnat/a-cbmutr.adb b/gcc/ada/libgnat/a-cbmutr.adb index cdc2629..fb8585a 100644 --- a/gcc/ada/libgnat/a-cbmutr.adb +++ b/gcc/ada/libgnat/a-cbmutr.adb @@ -1767,10 +1767,8 @@ package body Ada.Containers.Bounded_Multiway_Trees is (Container : Tree; From, To : Count_Type) return Boolean is - Idx : Count_Type; - + Idx : Count_Type'Base := From; begin - Idx := From; while Idx >= 0 loop if Idx = To then return True; |