public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-5654] ada: Fix string indexing within GNAT.Calendar.Time_IO.Value
@ 2023-11-21 9:59 Marc Poulhi?s
0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-11-21 9:59 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:5c7854b28f56634cc3a8afb7889d1a76883a0cf3
commit r14-5654-g5c7854b28f56634cc3a8afb7889d1a76883a0cf3
Author: Justin Squirek <squirek@adacore.com>
Date: Fri Oct 27 00:08:07 2023 +0000
ada: Fix string indexing within GNAT.Calendar.Time_IO.Value
The patch fixes an issue in the compiler whereby calls to
GNAT.Calendar.Time_IO.Value where the actual for formal String Date with
indexing starting at any value besides one would result in a spurious runtime
exception.
gcc/ada/
* libgnat/g-catiio.adb (Value): Modify conditionals to use 'Last
instead of 'Length
Diff:
---
gcc/ada/libgnat/g-catiio.adb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/libgnat/g-catiio.adb b/gcc/ada/libgnat/g-catiio.adb
index 42b86cce4a1..d80e6fc1ca0 100644
--- a/gcc/ada/libgnat/g-catiio.adb
+++ b/gcc/ada/libgnat/g-catiio.adb
@@ -849,7 +849,7 @@ package body GNAT.Calendar.Time_IO is
begin
Advance_Digits (Num_Digits => 1);
- while Index <= Date'Length and then Symbol in '0' .. '9' loop
+ while Index <= Date'Last and then Symbol in '0' .. '9' loop
Advance;
end loop;
@@ -1005,7 +1005,7 @@ package body GNAT.Calendar.Time_IO is
-- Check for trailing characters
- if Index /= Date'Length + 1 then
+ if Index /= Date'Last + 1 then
raise Wrong_Syntax;
end if;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-21 9:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-21 9:59 [gcc r14-5654] ada: Fix string indexing within GNAT.Calendar.Time_IO.Value Marc Poulhi?s
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).