[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 21 Oct 2010 09:55:51 +0000 (11:55 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 21 Oct 2010 09:55:51 +0000 (11:55 +0200)
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

gcc/ada/ChangeLog
gcc/ada/exp_ch5.adb
gcc/ada/par-ch3.adb
gcc/ada/sem_attr.adb

index 416cb95eddc26b8aa95f1f1e1f7e4c00f35065a6..76b69a1c3080f763dc80ff5501846b48ab69c421 100644 (file)
@@ -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,
index 2dbfe349dfe2ae80f5e8f9ffba3c06ed1fa7f5d8..7c69d5e634e6c56f6ddf61ee4a672b22c1604f5f 100644 (file)
@@ -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;
index 126fb4ab0cf30987ee00ce044c37bdc4585b5696..87f03a92476b45c441612513c133a1108afeaae6 100644 (file)
@@ -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);
index 264ea6964422a30e06a2fd75b358588d088d3625..6b5741a24ea6f15d9f60095b7ec64e67158fe730 100644 (file)
@@ -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