aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gnat.com>2001-10-30 21:27:26 +0000
committerGeert Bosch <bosch@gcc.gnu.org>2001-10-30 22:27:26 +0100
commit5dece937ef0712e0d60863f0db867d0abe72623a (patch)
tree090df2ad7f8666c81f5171d9da5a8287e39158af
parentde4bf6cb941ee680b22e4f5f7bf3fd42023ffce9 (diff)
downloadgcc-5dece937ef0712e0d60863f0db867d0abe72623a.zip
gcc-5dece937ef0712e0d60863f0db867d0abe72623a.tar.gz
gcc-5dece937ef0712e0d60863f0db867d0abe72623a.tar.bz2
* utils2.c (build_allocator): Test for SIZE overflow in array case too
From-SVN: r46653
-rw-r--r--gcc/ada/ChangeLog4
-rw-r--r--gcc/ada/utils2.c5
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a075fd9..ea236fc 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-30 Richard Kenner <kenner@gnat.com>
+
+ * utils2.c (build_allocator): Test for SIZE overflow in array case too
+
2001-10-30 Geert Bosch <bosch@gnat.com>
* ali-util.adb (Initialize_Checksum): Use out-mode instead of in out.
diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c
index 7cc8a3f..a5363a7 100644
--- a/gcc/ada/utils2.c
+++ b/gcc/ada/utils2.c
@@ -1855,6 +1855,11 @@ build_allocator (type, init, result_type, gnat_proc, gnat_pool)
&& contains_placeholder_p (size))
size = build (WITH_RECORD_EXPR, sizetype, size, init);
+ /* If the size overflows, pass -1 so the allocator will raise
+ storage error. */
+ if (TREE_CODE (size) == INTEGER_CST && TREE_OVERFLOW (size))
+ size = ssize_int (-1);
+
storage = build_call_alloc_dealloc (NULL_TREE, size,
TYPE_ALIGN (storage_type),
gnat_proc, gnat_pool);