+2018-05-30 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Access_Subprogram_Declaration): The flag
+ Needs_Activation_Record is only needed on a subprogram type, not on a
+ pointer to such.
+ * sem_res.adb (Resolve_Selected_Component): If the context type and the
+ component type are anonymous access to subprograms, use the component
+ type to obtain the proper value of Needs_Activation_Record flag for the
+ expression.
+
2018-05-30 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (gnat_to_gnu) <N_Assignment_Statement>: Add
-- If the access_to_subprogram is not declared at the library level,
-- it can only point to subprograms that are at the same or deeper
- -- accessibility level. All such might require an activation record
- -- when compiling for C.
+ -- accessibility level. The corresponding subprogram type might
+ -- require an activation record when compiling for C.
- Set_Needs_Activation_Record (T_Name,
- not Is_Library_Level_Entity (T_Name));
Set_Needs_Activation_Record (Desig_Type,
not Is_Library_Level_Entity (T_Name));
Set_Etype (N, Typ);
Set_Entity_With_Checks (S, Comp1);
+ -- The type of the context and that of the component are
+ -- compatible and in general identical, but if they are anonymous
+ -- access_to_subprogram types the relevwnt type is that of the
+ -- component. Thid matters in Unnest_Subprograms mode, where the
+ -- relevant context is the one in which the type is declared. not
+ -- the point of use. this determines what activation record to use.
+
+ if Ekind (Typ) = E_Anonymous_Access_Subprogram_Type then
+ Set_Etype (N, Etype (Comp1));
+ end if;
+
else
-- Resolve prefix with its type