aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat/s-valueu.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/libgnat/s-valueu.adb')
-rw-r--r--gcc/ada/libgnat/s-valueu.adb9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/ada/libgnat/s-valueu.adb b/gcc/ada/libgnat/s-valueu.adb
index 72e73a8..a27e00f 100644
--- a/gcc/ada/libgnat/s-valueu.adb
+++ b/gcc/ada/libgnat/s-valueu.adb
@@ -73,6 +73,15 @@ package body System.Value_U is
end if;
P := Ptr.all;
+
+ -- Exit when the initial string to parse is empty
+
+ if Max < P then
+ raise Program_Error with
+ "Scan end Max=" & Max'Img &
+ " is smaller than scan end Ptr=" & P'Img;
+ end if;
+
Uval := Character'Pos (Str (P)) - Character'Pos ('0');
pragma Assert (Str (P) in '0' .. '9');
P := P + 1;