From: Arnaud Charlet Date: Thu, 21 Oct 2010 09:55:51 +0000 (+0200) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=25e29378a7f781e861ed4efead33b7c62ef1eab3;p=gcc.git [multiple changes] 2010-10-21 Javier Miranda * sem_attr.adb (Resolve_Attribute): After replacing the range attribute node with a range expression ensure that its evaluation will not have side effects. * exp_ch5.adb (Expand_Assign_Array): Propagate the Parent to the unchecked conversion node generated to handle assignment of private types. Required to allow climbing the subtree if Insert_Action is invoked later. 2010-10-21 Robert Dewar * par-ch3.adb (P_Interface_Type_Definition): Allow for possibility of aspect clause presence terminating the type definition. From-SVN: r165757 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 416cb95eddc..76b69a1c308 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,18 @@ +2010-10-21 Javier Miranda + + * sem_attr.adb (Resolve_Attribute): After replacing the range attribute + node with a range expression ensure that its evaluation will not have + side effects. + * exp_ch5.adb (Expand_Assign_Array): Propagate the Parent to the + unchecked conversion node generated to handle assignment of private + types. Required to allow climbing the subtree if Insert_Action is + invoked later. + +2010-10-21 Robert Dewar + + * par-ch3.adb (P_Interface_Type_Definition): Allow for possibility of + aspect clause presence terminating the type definition. + 2010-10-21 Robert Dewar * exp_ch4.adb, exp_intr.adb, par-ch4.adb, scn.adb, sem_ch4.adb, diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 2dbfe349dfe..7c69d5e634e 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -562,15 +562,23 @@ package body Exp_Ch5 is -- cannot assign to elements of the array without this extra -- unchecked conversion. + -- Note: We must propagate Parent to the conversion node to allow + -- climbing the subtree if Insert_Action is invoked later. + if Nkind (Act_Lhs) = N_Slice then Larray := Prefix (Act_Lhs); else Larray := Act_Lhs; if Is_Private_Type (Etype (Larray)) then - Larray := - Unchecked_Convert_To - (Underlying_Type (Etype (Larray)), Larray); + declare + Par : constant Node_Id := Parent (Larray); + begin + Larray := + Unchecked_Convert_To + (Underlying_Type (Etype (Larray)), Larray); + Set_Parent (Larray, Par); + end; end if; end if; @@ -580,9 +588,14 @@ package body Exp_Ch5 is Rarray := Act_Rhs; if Is_Private_Type (Etype (Rarray)) then - Rarray := - Unchecked_Convert_To - (Underlying_Type (Etype (Rarray)), Rarray); + declare + Par : constant Node_Id := Parent (Rarray); + begin + Rarray := + Unchecked_Convert_To + (Underlying_Type (Etype (Rarray)), Rarray); + Set_Parent (Rarray, Par); + end; end if; end if; @@ -1049,6 +1062,8 @@ package body Exp_Ch5 is return Step; end Build_Step; + -- Start of processing for Expand_Assign_Array_Loop + begin if Rev then F_Or_L := Name_Last; diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb index 126fb4ab0cf..87f03a92476 100644 --- a/gcc/ada/par-ch3.adb +++ b/gcc/ada/par-ch3.adb @@ -3784,7 +3784,7 @@ package body Ch3 is -- Ada 2005 (AI-345): In case of interfaces with a null list of -- interfaces we build a record_definition node. - if Token = Tok_Semicolon then + if Token = Tok_Semicolon or else Aspect_Specifications_Present then Typedef_Node := New_Node (N_Record_Definition, Token_Ptr); Set_Abstract_Present (Typedef_Node); diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 264ea696442..6b5741a24ea 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -8791,6 +8791,11 @@ package body Sem_Attr is Rewrite (N, Make_Range (Loc, LB, HB)); Analyze_And_Resolve (N, Typ); + -- Ensure that the expanded range does not have side effects + + Force_Evaluation (LB); + Force_Evaluation (HB); + -- Normally after resolving attribute nodes, Eval_Attribute -- is called to do any possible static evaluation of the node. -- However, here since the Range attribute has just been