Relational operations on Uint are overloaded to accept Int as one of the
operands. There is no need to explicitly convert such operands with
UI_To_Int. Cleanup only; semantics is unaffected.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * exp_disp.adb (Make_Tags): Remove call to UI_To_Int.
        * sem_attr.adb (Check_Array_Type): Likewise; also, refine type
        of a local variable.
        (Analyze_Attribute): Likewise.
        (Get_Enclosing_Object): Likewise.
        * sem_util.adb (Get_Enum_Lit_From_Pos): Likewise.
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -7241,7 +7241,7 @@ package body Exp_Disp is
       --     is used by Build_Get_Prim_Op_Address to expand dispatching calls
       --     through the primary dispatch table.
 
-      if UI_To_Int (DT_Entry_Count (First_Tag_Component (Typ))) = 0 then
+      if DT_Entry_Count (First_Tag_Component (Typ)) = 0 then
          Analyze_List (Result);
 
       --     Generate:


diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -1656,7 +1656,7 @@ package body Sem_Attr is
       ----------------------
 
       procedure Check_Array_Type is
-         D : Int;
+         D : Pos;
          --  Dimension number for array attributes
 
       begin
@@ -1741,9 +1741,7 @@ package body Sem_Attr is
                  ("expression for dimension must be static!", E1);
                Error_Attr;
 
-            elsif UI_To_Int (Expr_Value (E1)) > D
-              or else UI_To_Int (Expr_Value (E1)) < 1
-            then
+            elsif Expr_Value (E1) > D or else Expr_Value (E1) < 1 then
                Error_Attr ("invalid dimension number for array type", E1);
             end if;
          end if;
@@ -4838,7 +4836,7 @@ package body Sem_Attr is
                Error_Attr;
 
             elsif UI_To_Int (Intval (E1)) > Number_Formals (Entity (P))
-              or else UI_To_Int (Intval (E1)) < 0
+              or else Intval (E1) < 0
             then
                Error_Attr ("invalid parameter number for % attribute", E1);
             end if;


diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -10553,7 +10553,7 @@ package body Sem_Util is
 
          --  Position in the enumeration type starts at 0
 
-         if UI_To_Int (Pos) < 0 then
+         if Pos < 0 then
             raise Constraint_Error;
          end if;
 


Reply via email to