]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix calculation of tasks in null arrays
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 10 Jan 2024 17:48:04 +0000 (18:48 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 7 May 2024 07:55:59 +0000 (09:55 +0200)
Fix handling of null arrays when calculating the secondary stack size
for the binder.

gcc/ada/

* sem_util.adb (Number_Of_Elements_In_Array): Fix counting of
elements in null arrays; remove redundant parenthesis; avoid
run-time conversion of 1 to universal integer.

gcc/ada/sem_util.adb

index bee078e6df5587b2f6a9d8e2cfc75da5ad7b363b..5f44b4c26fe54bba5eaca8dab5d4ae1814933876 100644 (file)
@@ -25404,7 +25404,8 @@ package body Sem_Util is
             return 0;
          else
             Num :=
-              Num * UI_To_Int ((Expr_Value (High) - Expr_Value (Low) + 1));
+              Num * Int'Max
+                (0, UI_To_Int (Expr_Value (High) - Expr_Value (Low) + Uint_1));
          end if;
 
          Next_Index (Indx);