diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb --- a/gcc/ada/aspects.adb +++ b/gcc/ada/aspects.adb @@ -285,7 +285,9 @@ package body Aspects is begin if Present (Spec) then - if A = Aspect_Default_Iterator then + if A = Aspect_Default_Iterator + and then Present (Aspect_Rep_Item (Spec)) + then return Expression (Aspect_Rep_Item (Spec)); else return Expression (Spec); diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -9248,19 +9248,6 @@ package body Sem_Ch4 is Save_Interps (Subprog, Node_To_Replace); else - -- The type of the subprogram may be a limited view obtained - -- transitively from another unit. If full view is available, - -- use it to analyze call. If there is no nonlimited view, then - -- this is diagnosed when analyzing the rewritten call. - - declare - T : constant Entity_Id := Etype (Subprog); - begin - if From_Limited_With (T) then - Set_Etype (Entity (Subprog), Available_View (T)); - end if; - end; - Analyze (Node_To_Replace); -- If the operation has been rewritten into a call, which may get diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -3675,6 +3675,7 @@ package body Sem_Ch5 is begin return Present (Def_Iter) + and then Present (Etype (Def_Iter)) and then Requires_Transient_Scope (Etype (Def_Iter)); end Has_Sec_Stack_Default_Iterator;