From: Piotr Trojanek <troja...@adacore.com>

Routine Is_OK_Static_Expression itself calls Raises_Constraint_Error, so there
is no need to call both of these routines in a row. Code cleanup; semantics is
unaffected.

gcc/ada/ChangeLog:

        * sem_attr.adb (Check_Array_Type): Remove extra call.
        * sem_util.adb (Static_Boolean): Likewise.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_attr.adb |  4 +---
 gcc/ada/sem_util.adb | 12 ++----------
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 6eb04b2e258..7295784704f 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -1994,9 +1994,7 @@ package body Sem_Attr is
             Resolve (E1, Any_Integer);
             Set_Etype (E1, Standard_Integer);
 
-            if not Is_OK_Static_Expression (E1)
-              or else Raises_Constraint_Error (E1)
-            then
+            if not Is_OK_Static_Expression (E1) then
                Flag_Non_Static_Expr
                  ("expression for dimension must be static!", E1);
                Error_Attr;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index bd798d74885..c1af2281a22 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -28232,11 +28232,7 @@ package body Sem_Util is
       end if;
 
       if Is_OK_Static_Expression (N) then
-         if not Raises_Constraint_Error (N) then
-            return Expr_Value (N);
-         else
-            return No_Uint;
-         end if;
+         return Expr_Value (N);
 
       elsif Etype (N) = Any_Type then
          return No_Uint;
@@ -28264,11 +28260,7 @@ package body Sem_Util is
       end if;
 
       if Is_OK_Static_Expression (N) then
-         if not Raises_Constraint_Error (N) then
-            return Expr_Value (N);
-         else
-            return No_Uint;
-         end if;
+         return Expr_Value (N);
 
       elsif Etype (N) = Any_Type then
          return No_Uint;
-- 
2.43.0

Reply via email to