diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-21 11:55:51 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-21 11:55:51 +0200 |
commit | 25e29378a7f781e861ed4efead33b7c62ef1eab3 (patch) | |
tree | b4ba5b68e043d3f97abc249c3fb24a8b62d7feab /gcc | |
parent | 90c63b098ced9fb7b17143e4e5a4f860d31ea680 (diff) | |
download | gcc-25e29378a7f781e861ed4efead33b7c62ef1eab3.zip gcc-25e29378a7f781e861ed4efead33b7c62ef1eab3.tar.gz gcc-25e29378a7f781e861ed4efead33b7c62ef1eab3.tar.bz2 |
[multiple changes]
2010-10-21 Javier Miranda <miranda@adacore.com>
* 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 <dewar@adacore.com>
* par-ch3.adb (P_Interface_Type_Definition): Allow for possibility of
aspect clause presence terminating the type definition.
From-SVN: r165757
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/ada/exp_ch5.adb | 27 | ||||
-rw-r--r-- | gcc/ada/par-ch3.adb | 2 | ||||
-rw-r--r-- | gcc/ada/sem_attr.adb | 5 |
4 files changed, 42 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 416cb95..76b69a1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,18 @@ +2010-10-21 Javier Miranda <miranda@adacore.com> + + * 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 <dewar@adacore.com> + + * par-ch3.adb (P_Interface_Type_Definition): Allow for possibility of + aspect clause presence terminating the type definition. + 2010-10-21 Robert Dewar <dewar@adacore.com> * 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 2dbfe34..7c69d5e 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 126fb4a..87f03a9 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 264ea69..6b5741a 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 |