From: Piotr Trojanek Date: Mon, 23 Nov 2020 22:52:59 +0000 (+0100) Subject: [Ada] Remove redundant calls to UI_To_Int in relational operands X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9c852dfb057c645e1dc1e29115e57062b878bdc5;p=gcc.git [Ada] Remove redundant calls to UI_To_Int in relational operands 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 index 1a41d794bfd..14f25db390d 100644 --- 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 index 537da93dc66..58cb92fb54b 100644 --- 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 index 30d4457ea31..063860af48c 100644 --- 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;