aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorVincent Celier <celier@adacore.com>2007-06-06 12:21:22 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-06-06 12:21:22 +0200
commitb3a22f38ea7617e609a73938d0db11cf4f77f5dc (patch)
treefe058ca7174400369c44887a7119615a5f57cd46 /gcc/ada
parentcc9e83af090f59d5cced28b88b7096f0f70f941c (diff)
downloadgcc-b3a22f38ea7617e609a73938d0db11cf4f77f5dc.zip
gcc-b3a22f38ea7617e609a73938d0db11cf4f77f5dc.tar.gz
gcc-b3a22f38ea7617e609a73938d0db11cf4f77f5dc.tar.bz2
a-tifiio.adb (Put, internal): For negative numbers...
2007-04-20 Vincent Celier <celier@adacore.com> * a-tifiio.adb (Put, internal): For negative numbers, check that there is room for at least one digit and the minus sign. (Put.Put_Character): Never put a character outside of the range of string To. From-SVN: r125382
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/a-tifiio.adb10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/ada/a-tifiio.adb b/gcc/ada/a-tifiio.adb
index fe06c2c..92c24ea 100644
--- a/gcc/ada/a-tifiio.adb
+++ b/gcc/ada/a-tifiio.adb
@@ -399,7 +399,7 @@ package body Ada.Text_IO.Fixed_IO is
Last : Natural;
begin
- if Fore < 1 or else Fore > Field'Last then
+ if Fore - Boolean'Pos (Item < 0.0) < 1 or else Fore > Field'Last then
raise Layout_Error;
end if;
@@ -462,7 +462,13 @@ package body Ada.Text_IO.Fixed_IO is
procedure Put_Character (C : Character) is
begin
Last := Last + 1;
- To (Last) := C;
+
+ -- Never put a character outside of string To. Exception Layout_Error
+ -- will be raised later if Last is greater than To'Last.
+
+ if Last <= To'Last then
+ To (Last) := C;
+ end if;
end Put_Character;
---------------