Commit 18ba4b0d by Bob Duff Committed by Pierre-Marie de Rodat

[Ada] Prevent crash in Put_Scaled

This patch fixes a bug in Put_Scaled, which causes a crash when checks
are on.

2019-08-12  Bob Duff  <duff@adacore.com>

gcc/ada/

	* libgnat/a-tifiio.adb (Put_Scaled): Prevent AA from being
	negative, since Field is range 0 .. something.

From-SVN: r274300
parent 0e5f9f50
2019-08-12 Bob Duff <duff@adacore.com> 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.
2019-08-12 Bob Duff <duff@adacore.com>
* doc/gnat_ugn/gnat_utility_programs.rst (gnatmetric, gnatpp, * doc/gnat_ugn/gnat_utility_programs.rst (gnatmetric, gnatpp,
gnatstub): Remove documentation for Ada language version gnatstub): Remove documentation for Ada language version
switches, and note that they are no longer needed. switches, and note that they are no longer needed.
......
...@@ -560,7 +560,7 @@ package body Ada.Text_IO.Fixed_IO is ...@@ -560,7 +560,7 @@ package body Ada.Text_IO.Fixed_IO is
E : Integer) E : Integer)
is is
pragma Assert (E >= -Max_Digits); 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; N : constant Natural := (AA + Max_Digits - 1) / Max_Digits + 1;
Q : array (0 .. N - 1) of Int64 := (others => 0); Q : array (0 .. N - 1) of Int64 := (others => 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment