summaryrefslogtreecommitdiff
path: root/gcc/ada/a-convec.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-14 08:27:05 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-14 08:27:05 +0000
commit9474aa9c30199162379e6e2bf93c9d2b36743bef (patch)
treeee6e80da2c8b0f47fcfe335443bad67c02958fa3 /gcc/ada/a-convec.adb
parente34b15ab0f115b6223abbde4ffc5d651d6c6ec95 (diff)
downloadgcc-9474aa9c30199162379e6e2bf93c9d2b36743bef.tar.gz
2010-06-14 Robert Dewar <dewar@adacore.com>
* a-convec.adb, sem_prag.adb, checks.adb: Minor reformatting 2010-06-14 Eric Botcazou <ebotcazou@adacore.com> * init.c: Code clean up. 2010-06-14 Ed Schonberg <schonberg@adacore.com> * sem_ch13.adb (Analyze_Attribute_Definition_Clause, case Address): Do not insert address clause in table for later validation if type of entity is generic, to prevent possible spurious errors. * sem_ch8.adb: Code clean up. 2010-06-14 Ben Brosgol <brosgol@adacore.com> * gnat_ugn.texi: Expanded @ovar macro inline to solve problem with texi2pdf and texi2html. Document how to change scheduling properties on HP-UX. 2010-06-14 Thomas Quinot <quinot@adacore.com> * g-socket.ads: Remove misleading comments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160711 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-convec.adb')
-rw-r--r--gcc/ada/a-convec.adb4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/ada/a-convec.adb b/gcc/ada/a-convec.adb
index 73151bc9870..8d146b07dec 100644
--- a/gcc/ada/a-convec.adb
+++ b/gcc/ada/a-convec.adb
@@ -103,10 +103,12 @@ package body Ada.Containers.Vectors is
-- end of the range of Int.
if Index_Type'First <= 0 then
+
-- Compute the potential Last index value in the normal way, using
-- Int as the type in which to perform intermediate
-- calculations. Int is a 64-bit type, and Count_Type is a 32-bit
-- type, so no overflow can occur.
+
J := Int (Index_Type'First - 1) + N;
if J > Int (Index_Type'Last) then
@@ -120,6 +122,7 @@ package body Ada.Containers.Vectors is
-- greater than Index_Type'Last (as we do above), we work
-- backwards by computing the potential First index value, and
-- then checking whether that value is less than Index_Type'First.
+
J := Int (Index_Type'Last) - N + 1;
if J < Int (Index_Type'First) then
@@ -129,6 +132,7 @@ package body Ada.Containers.Vectors is
-- We have determined that Length would not create a Last index
-- value outside of the range of Index_Type, so we can now safely
-- compute its value.
+
J := Int (Index_Type'First - 1) + N;
end if;