From 7f37fff1a17d12538973f68be49ba3d6030a495d Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 16 Oct 2015 15:41:29 +0200 Subject: [multiple changes] 2015-10-16 Javier Miranda * sem_ch5.adb (Analyze_Iterator_Specification): Associate a transient scope with the renaming object declararation. * exp_util.adb (Insert_Actions): if the enclosing interator loop is marked as requiring the secondary stack then attach the actions to the transient scope. 2015-10-16 Bob Duff * exp_ch7.adb: Minor spelling fixes. 2015-10-16 Ed Schonberg * sem_ch3.adb (Replace_Anonymous_Access_To_Protected_Subprogram): If anonymous type is component type of array type declaration, analyze its declaration in the current scope, not the enclosing one. From-SVN: r228906 --- gcc/ada/ChangeLog | 19 +++++++++++++++++++ gcc/ada/exp_ch7.adb | 18 +++++++++--------- gcc/ada/exp_util.adb | 16 ++++++++++++++++ gcc/ada/sem_ch3.adb | 8 +++++++- gcc/ada/sem_ch5.adb | 11 +++++++++++ gcc/ada/sem_util.adb | 6 +++--- 6 files changed, 65 insertions(+), 13 deletions(-) (limited to 'gcc/ada') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9c06896..d8f2b58 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,22 @@ +2015-10-16 Javier Miranda + + * sem_ch5.adb (Analyze_Iterator_Specification): Associate a + transient scope with the renaming object declararation. + * exp_util.adb (Insert_Actions): if the enclosing interator + loop is marked as requiring the secondary stack then attach the + actions to the transient scope. + +2015-10-16 Bob Duff + + * exp_ch7.adb: Minor spelling fixes. + +2015-10-16 Ed Schonberg + + * sem_ch3.adb (Replace_Anonymous_Access_To_Protected_Subprogram): + If anonymous type is component type of array type declaration, + analyze its declaration in the current scope, not the enclosing + one. + 2015-10-16 Gary Dismukes * prj.adb, sem_util.adb, exp_ch6.adb: Minor reformatting. diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 2f90c92..3836e85 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -1109,7 +1109,7 @@ package body Exp_Ch7 is Finalizer_Decls : List_Id := No_List; -- Local variable declarations. This list holds the label declarations -- of all jump block alternatives as well as the declaration of the - -- local exception occurence and the raised flag: + -- local exception occurrence and the raised flag: -- E : Exception_Occurrence; -- Raised : Boolean := False; -- L : label; @@ -5283,7 +5283,7 @@ package body Exp_Ch7 is -- Abort : constant Boolean := Triggered_By_Abort; -- -- Abort : constant Boolean := False; -- no abort - -- E : Exception_Occurence; + -- E : Exception_Occurrence; -- Raised : Boolean := False; -- begin @@ -6047,7 +6047,7 @@ package body Exp_Ch7 is -- when others => -- if not Raised then -- Raised := True; - -- Save_Occurence (E, Get_Current_Excep.all.all); + -- Save_Occurrence (E, Get_Current_Excep.all.all); -- end if; -- end; -- end if; @@ -6065,7 +6065,7 @@ package body Exp_Ch7 is -- Abort : constant Boolean := Triggered_By_Abort; -- -- Abort : constant Boolean := False; -- no abort - -- E : Exception_Occurence; + -- E : Exception_Occurrence; -- Raised : Boolean := False; -- -- begin @@ -6076,7 +6076,7 @@ package body Exp_Ch7 is -- when others => -- if not Raised then -- Raised := True; - -- Save_Occurence (E, Get_Current_Excep.all.all); + -- Save_Occurrence (E, Get_Current_Excep.all.all); -- end if; -- end; -- end if; @@ -6100,7 +6100,7 @@ package body Exp_Ch7 is -- when others => -- if not Raised then -- Raised := True; - -- Save_Occurence (E, Get_Current_Excep.all.all); + -- Save_Occurrence (E, Get_Current_Excep.all.all); -- end if; -- end; -- . . . @@ -6111,7 +6111,7 @@ package body Exp_Ch7 is -- when others => -- if not Raised then -- Raised := True; - -- Save_Occurence (E, Get_Current_Excep.all.all); + -- Save_Occurrence (E, Get_Current_Excep.all.all); -- end if; -- end; -- <> @@ -6533,7 +6533,7 @@ package body Exp_Ch7 is -- -- Abort : constant Boolean := False; -- no abort - -- E : Exception_Occurence; + -- E : Exception_Occurrence; -- Raised : Boolean := False; -- begin @@ -7105,7 +7105,7 @@ package body Exp_Ch7 is -- -- Abort : constant Boolean := False; -- no abort - -- E : Exception_Occurence; + -- E : Exception_Occurrence; -- Raised : Boolean := False; -- begin diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index fb0d487..56f9b9a 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -4034,6 +4034,22 @@ package body Exp_Util is end if; return; + + -- Iteration scheme located in a transient scope + + elsif Nkind (P) = N_Iteration_Scheme + and then Present (Wrapped_Node) + then + -- If the enclosing iterator loop is marked as requiring the + -- secondary stack then the actions must be inserted in the + -- transient scope. + + if Uses_Sec_Stack + (Find_Enclosing_Iterator_Loop (Current_Scope)) + then + Store_Before_Actions_In_Scope (Ins_Actions); + return; + end if; end if; -- Statements, declarations, pragmas, representation clauses diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index f21edeb..542ea3f 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -5913,7 +5913,13 @@ package body Sem_Ch3 is Mark_Rewrite_Insertion (Comp); - if Nkind_In (N, N_Object_Declaration, N_Access_Function_Definition) then + if Nkind_In (N, N_Object_Declaration, N_Access_Function_Definition) + or else (Nkind (Parent (N)) = N_Full_Type_Declaration + and then not Is_Type (Current_Scope)) + then + + -- Declaration can be analyzed in the current scope. + Analyze (Decl); else diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index d2d5f25..234317c 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -30,6 +30,7 @@ with Einfo; use Einfo; with Errout; use Errout; with Expander; use Expander; with Exp_Ch6; use Exp_Ch6; +with Exp_Ch7; use Exp_Ch7; with Exp_Util; use Exp_Util; with Freeze; use Freeze; with Ghost; use Ghost; @@ -1959,6 +1960,16 @@ package body Sem_Ch5 is Name => New_Copy_Tree (Iter_Name, New_Sloc => Loc)); + -- Create a transient scope to ensure that all the temporaries + -- generated by Remove_Side_Effects as part of processing this + -- renaming declaration (if any) are attached by Insert_Actions + -- to it. It has no effect on the generated code if no actions + -- are added to it (see Wrap_Transient_Declaration). + + if Expander_Active then + Establish_Transient_Scope (Name (Decl), Sec_Stack => True); + end if; + Insert_Actions (Parent (Parent (N)), New_List (Decl)); Rewrite (Name (N), New_Occurrence_Of (Id, Loc)); Set_Etype (Id, Typ); diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 214ec62..2fa6253 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -2346,9 +2346,9 @@ package body Sem_Util is return Id; end Get_Function_Id; - --------------------------- - -- Preanalyze_Expression -- - --------------------------- + ------------------------------- + -- Preanalyze_Without_Errors -- + ------------------------------- procedure Preanalyze_Without_Errors (N : Node_Id) is Status : constant Boolean := Get_Ignore_Errors; -- cgit v1.1