https://gcc.gnu.org/g:d9a51b704fe521fecb2e77931226c8e8798a9910

commit r15-6540-gd9a51b704fe521fecb2e77931226c8e8798a9910
Author: Piotr Trojanek <troja...@adacore.com>
Date:   Thu Dec 5 16:59:36 2024 +0100

    ada: Remove extra checks for raising a constraint error
    
    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.

Diff:
---
 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 6eb04b2e2582..7295784704fd 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 bd798d74885c..c1af2281a22b 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;

Reply via email to