| N_Iterated_Component_Association
| N_Iterated_Element_Association
=>
- if Nkind (Parent (P)) = N_Aggregate
- and then Present (Loop_Actions (P))
+ if Nkind (Parent (P)) in N_Aggregate | N_Delta_Aggregate
+
+ -- We must not climb up out of an N_Iterated_xxx_Association
+ -- because the actions might contain references to the loop
+ -- parameter. But it turns out that setting the Loop_Actions
+ -- attribute in the case of an N_Component_Association
+ -- when the attribute was not already set can lead to
+ -- (as yet not understood) bugboxes (gcc failures that are
+ -- presumably due to malformed trees). So we don't do that.
+
+ and then (Nkind (P) /= N_Component_Association
+ or else Present (Loop_Actions (P)))
then
if Is_Empty_List (Loop_Actions (P)) then
Set_Loop_Actions (P, Ins_Actions);
return;
end if;
+ -- 'Old attribute reference ok in a _Postconditions procedure
+
+ elsif Nkind (Prag) = N_Subprogram_Body
+ and then not Comes_From_Source (Prag)
+ and then Nkind (Corresponding_Spec (Prag)) = N_Defining_Identifier
+ and then Chars (Corresponding_Spec (Prag)) = Name_uPostconditions
+ then
+ null;
+
-- Otherwise the placement of the attribute is illegal
else
if Nkind (Prag) = N_Aspect_Specification then
Subp_Decl := Parent (Prag);
+ elsif Nkind (Prag) = N_Subprogram_Body then
+ declare
+ Enclosing_Scope : constant Node_Id :=
+ Scope (Corresponding_Spec (Prag));
+ begin
+ pragma Assert (Postconditions_Proc (Enclosing_Scope)
+ = Corresponding_Spec (Prag));
+ Subp_Decl := Parent (Parent (Enclosing_Scope));
+ end;
else
Subp_Decl := Find_Related_Declaration_Or_Body (Prag);
end if;