+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,
-- 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;
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;
return Step;
end Build_Step;
+ -- Start of processing for Expand_Assign_Array_Loop
+
begin
if Rev then
F_Or_L := Name_Last;
-- 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);
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