This patch fixes a bug in Put_Scaled, which causes a crash when checks
are on.
Tested on x86_64-pc-linux-gnu, committed on trunk
2019-08-12 Bob Duff <d...@adacore.com>
gcc/ada/
* libgnat/a-tifiio.adb (Put_Scaled): Prevent AA from being
negative, since Field is range 0 .. something.
--- gcc/ada/libgnat/a-tifiio.adb
+++ gcc/ada/libgnat/a-tifiio.adb
@@ -560,7 +560,7 @@ package body Ada.Text_IO.Fixed_IO is
E : Integer)
is
pragma Assert (E >= -Max_Digits);
- AA : constant Field := E + A;
+ AA : constant Field := Integer'Max (E + A, 0);
N : constant Natural := (AA + Max_Digits - 1) / Max_Digits + 1;
Q : array (0 .. N - 1) of Int64 := (others => 0);