]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Do not issue size error for too large array type
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 14 Sep 2021 09:14:37 +0000 (11:14 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Tue, 14 Sep 2021 09:14:37 +0000 (11:14 +0200)
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.

gcc/ada/gcc-interface/decl.c

index 20e3eea4cc507ccc6e376b6b312207b9dd0e5a86..0120b213a77d6c1d073e61409095fe6ac9158aa2 100644 (file)
@@ -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;