From cb478e0a6f3a296e1c234a85fc0d45d633a0ff93 Mon Sep 17 00:00:00 2001 From: Piotr Trojanek Date: Wed, 10 Jan 2024 18:48:04 +0100 Subject: ada: Fix calculation of tasks in null arrays 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/ada') diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index bee078e..5f44b4c 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -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); -- cgit v1.1