Local variables in parsing of formal object declarations take only
positive values, so their types can be narrowed to Pos. Cleanup only;
semantics is unaffected.

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

gcc/ada/

        * par-ch12.adb (P_Formal_Object_Declarations): Refine types to
        Pos.
diff --git a/gcc/ada/par-ch12.adb b/gcc/ada/par-ch12.adb
--- a/gcc/ada/par-ch12.adb
+++ b/gcc/ada/par-ch12.adb
@@ -423,12 +423,12 @@ package body Ch12 is
 
    procedure P_Formal_Object_Declarations (Decls : List_Id) is
       Decl_Node        : Node_Id;
-      Ident            : Nat;
+      Ident            : Pos;
       Not_Null_Present : Boolean := False;
-      Num_Idents       : Nat;
+      Num_Idents       : Pos;
       Scan_State       : Saved_Scan_State;
 
-      Idents : array (Int range 1 .. 4096) of Entity_Id;
+      Idents : array (Pos range 1 .. 4096) of Entity_Id;
       --  This array holds the list of defining identifiers. The upper bound
       --  of 4096 is intended to be essentially infinite, and we do not even
       --  bother to check for it being exceeded.


Reply via email to