diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 1946e68b3c76a1c5ea9e6898d74dcdcd8cc58f1a..a7c0584d8da453447d80c508fad31f7e3f39ce3d 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -4247,6 +4247,15 @@ package Einfo is
 --       within an accept statement. For all remaining cases (discriminants,
 --       loop parameters) the field is Empty.
 
+--    Renames_Limited_View
+--       Defined in package entities. True for a package renaming if either
+--       a) the renamed package is not itself a renaming, and the renaming
+--          denotes a limited view of the renamed package (as seen at the
+--          point of the renaming declaration, as opposed to later on when
+--          the renaming is referenced); or
+--       b) the renamed package is itself a renaming and the
+--          Renames_Limited_View flag is True for the renamed package.
+
 --    Requires_Overriding
 --       Defined in all subprograms and entries. Set for subprograms that
 --       require overriding as defined by RM-2005-3.9.3(6/2). Note that this
diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads
index c778f00856d4567d19d3bca2ba050a4c9bc6be27..fe2da80c548819893ba37d8b2ee848e085308f81 100644
--- a/gcc/ada/gen_il-fields.ads
+++ b/gcc/ada/gen_il-fields.ads
@@ -879,6 +879,7 @@ package Gen_IL.Fields is
       Relative_Deadline_Variable,
       Renamed_In_Spec,
       Renamed_Or_Alias, -- Shared among Alias, Renamed_Entity, Renamed_Object
+      Renames_Limited_View,
       Requires_Overriding,
       Return_Applies_To,
       Return_Present,
diff --git a/gcc/ada/gen_il-gen-gen_entities.adb b/gcc/ada/gen_il-gen-gen_entities.adb
index 8cf66b2611dfa834392a1e5655ec8f36e6dfbc6f..3df1f8e728443b43d28434d3d977273897764863 100644
--- a/gcc/ada/gen_il-gen-gen_entities.adb
+++ b/gcc/ada/gen_il-gen-gen_entities.adb
@@ -1281,6 +1281,7 @@ begin -- Gen_IL.Gen.Gen_Entities
         Sm (Related_Instance, Node_Id),
         Sm (Renamed_In_Spec, Flag),
         Sm (Renamed_Or_Alias, Node_Id),
+        Sm (Renames_Limited_View, Flag),
         Sm (Scope_Depth_Value, Unat),
         Sm (SPARK_Aux_Pragma, Node_Id),
         Sm (SPARK_Aux_Pragma_Inherited, Flag),
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 533b62aef32126cfb6d75bb1333926ea5ff1c277..c6b8f6c5d7c8439f94b92df8b61522641392855d 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -1665,8 +1665,7 @@ package body Sem_Ch8 is
          Set_Etype (New_P, Standard_Void_Type);
 
       elsif Present (Renamed_Entity (Old_P))
-        and then (From_Limited_With (Renamed_Entity (Old_P))
-                    or else Has_Limited_View (Renamed_Entity (Old_P)))
+        and then Renames_Limited_View (Old_P)
         and then not
           Unit_Is_Visible (Cunit (Get_Source_Unit (Renamed_Entity (Old_P))))
       then
@@ -1691,8 +1690,10 @@ package body Sem_Ch8 is
 
          if Present (Renamed_Entity (Old_P)) then
             Set_Renamed_Entity (New_P, Renamed_Entity (Old_P));
+            Set_Renames_Limited_View (New_P, Renames_Limited_View (Old_P));
          else
             Set_Renamed_Entity (New_P, Old_P);
+            Set_Renames_Limited_View (New_P, From_Limited_With (Old_P));
          end if;
 
          --  The package renaming declaration may become Ghost if it renames a
@@ -7077,7 +7078,7 @@ package body Sem_Ch8 is
               ("renaming of limited view of package & not usable in this"
                & " context (RM 8.5.3(3.1/2))", Prefix (N), P_Name);
 
-         elsif Has_Limited_View (P_Name)
+         elsif Renames_Limited_View (Entity (Prefix (N)))
            and then not Unit_Is_Visible (Cunit (Get_Source_Unit (P_Name)))
            and then not Is_Visible_Through_Renamings (P_Name)
          then