* [Ada] Prevent crash in Is_Reachable
@ 2019-08-12 9:46 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2019-08-12 9:46 UTC (permalink / raw)
To: gcc-patches; +Cc: Bob Duff
[-- Attachment #1: Type: text/plain, Size: 354 bytes --]
This patch fixes a bug in Is_Reachable, which causes a crash when checks
are on.
Tested on x86_64-pc-linux-gnu, committed on trunk
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.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 397 bytes --]
--- gcc/ada/libgnat/a-cbmutr.adb
+++ 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-08-12 9:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-12 9:46 [Ada] Prevent crash in Is_Reachable Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).