Commit 5dece937 by Richard Kenner Committed by Geert Bosch

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

From-SVN: r46653
parent de4bf6cb
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> 2001-10-30 Geert Bosch <bosch@gnat.com>
* ali-util.adb (Initialize_Checksum): Use out-mode instead of in out. * ali-util.adb (Initialize_Checksum): Use out-mode instead of in out.
......
...@@ -1855,6 +1855,11 @@ build_allocator (type, init, result_type, gnat_proc, gnat_pool) ...@@ -1855,6 +1855,11 @@ build_allocator (type, init, result_type, gnat_proc, gnat_pool)
&& contains_placeholder_p (size)) && contains_placeholder_p (size))
size = build (WITH_RECORD_EXPR, sizetype, size, init); 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, storage = build_call_alloc_dealloc (NULL_TREE, size,
TYPE_ALIGN (storage_type), TYPE_ALIGN (storage_type),
gnat_proc, gnat_pool); gnat_proc, gnat_pool);
......
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