diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index c65ea91cb13b3be86a727936917741fcce08fc22..e6e5d50dbbf62564835d07abcce20119bc2a9c6c 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -5331,16 +5331,17 @@ package body Exp_Ch6 is
 
       elsif Nkind (Call_Node) = N_Function_Call
         and then Nkind (Parent (Call_Node)) = N_Function_Call
+        and then Is_Entity_Name (Name (Parent (Call_Node)))
       then
          declare
             Aspect : constant Node_Id :=
               Find_Value_Of_Aspect
                 (Etype (Call_Node), Aspect_Constant_Indexing);
+            Subp   : constant Entity_Id := Entity (Name (Parent (Call_Node)));
 
          begin
             if Present (Aspect)
-              and then Is_Entity_Name (Name (Parent (Call_Node)))
-              and then Entity (Name (Parent (Call_Node))) = Entity (Aspect)
+              and then Subp = Ultimate_Alias (Entity (Aspect))
             then
                --  Resolution is now finished, make sure we don't start
                --  analysis again because of the duplication.
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index a9424b95880b1d024f1781654549a728df2b493c..25f9f077174b3b8a1bb4a4a95b1a2fb9042ddf89 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -8945,7 +8945,7 @@ package body Exp_Util is
          Aspect := Find_Value_Of_Aspect (Typ, Aspect_Constant_Indexing);
 
          if Present (Aspect) then
-            Index := Entity (Aspect);
+            Index := Ultimate_Alias (Entity (Aspect));
 
             --  Examine the statements following the container object and
             --  look for a call to the default indexing routine where the
@@ -9030,7 +9030,7 @@ package body Exp_Util is
          Aspect := Find_Value_Of_Aspect (Typ, Aspect_Default_Iterator);
 
          if Present (Aspect) then
-            Iter := Entity (Aspect);
+            Iter := Ultimate_Alias (Entity (Aspect));
 
             --  Examine the statements following the container object and
             --  look for a call to the default iterate routine where the