diff options
author | bosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-30 21:27:26 +0000 |
---|---|---|
committer | bosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-30 21:27:26 +0000 |
commit | 12399861c91cfa309e2c0c603f940b3568598cda (patch) | |
tree | 090df2ad7f8666c81f5171d9da5a8287e39158af /gcc/ada/utils2.c | |
parent | ca188295af5aaed051087b5cbf9f92e8d742dad5 (diff) | |
download | gcc-12399861c91cfa309e2c0c603f940b3568598cda.tar.gz |
* utils2.c (build_allocator): Test for SIZE overflow in array case too
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46653 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/utils2.c')
-rw-r--r-- | gcc/ada/utils2.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c index 7cc8a3f669a..a5363a71af3 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); |