diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index bee078e6df5587b2f6a9d8e2cfc75da5ad7b363b..5f44b4c26fe54bba5eaca8dab5d4ae1814933876 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);