* utils2.c (build_allocator): Test for SIZE overflow in array case too

From-SVN: r46653
This commit is contained in:
Richard Kenner 2001-10-30 21:27:26 +00:00 committed by Geert Bosch
parent de4bf6cb94
commit 5dece937ef
2 changed files with 9 additions and 0 deletions

View File

@ -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.

View File

@ -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);