aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2021-09-14 11:14:37 +0200
committerEric Botcazou <ebotcazou@adacore.com>2021-09-14 11:14:37 +0200
commitf349a8b5928ec66cad91c00623db67e747be1600 (patch)
treeddfeeabbfb568761dd28f74b20ee004b7770b57a
parentb9c35857d00c66158fcdf7de8adae4f06023052e (diff)
downloadgcc-f349a8b5928ec66cad91c00623db67e747be1600.zip
gcc-f349a8b5928ec66cad91c00623db67e747be1600.tar.gz
gcc-f349a8b5928ec66cad91c00623db67e747be1600.tar.bz2
Do not issue size error for too large array type
The error is to be issued when objects of the type are declared instead. gcc/ada/ * gcc-interface/decl.c (validate_size): Do not issue an error if the old size has overflowed.
-rw-r--r--gcc/ada/gcc-interface/decl.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 20e3eea..0120b21 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -9191,8 +9191,7 @@ validate_size (Uint uint_size, tree gnu_type, Entity_Id gnat_object,
/* Issue an error either if the default size of the object isn't a constant
or if the new size is smaller than it. */
if (TREE_CODE (old_size) != INTEGER_CST
- || TREE_OVERFLOW (old_size)
- || tree_int_cst_lt (size, old_size))
+ || (!TREE_OVERFLOW (old_size) && tree_int_cst_lt (size, old_size)))
{
char buf[128];
const char *s;