diff options
author | Ed Schonberg <schonberg@adacore.com> | 2018-05-30 08:57:11 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-05-30 08:57:11 +0000 |
commit | 131780ac08a8dfc1b9c14a9d5c38575fcc34b205 (patch) | |
tree | 03135074ed1d7327cd5b9f8fa522268ee535798c /gcc | |
parent | df8aa2b7e18670c97076083ea292a0a7b2d08263 (diff) | |
download | gcc-131780ac08a8dfc1b9c14a9d5c38575fcc34b205.zip gcc-131780ac08a8dfc1b9c14a9d5c38575fcc34b205.tar.gz gcc-131780ac08a8dfc1b9c14a9d5c38575fcc34b205.tar.bz2 |
[Ada] Refine logic to set Needs_Activation_Record on subprogram types
2018-05-30 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* 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.
From-SVN: r260932
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/ada/sem_ch3.adb | 6 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 11 |
3 files changed, 23 insertions, 4 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index df1daac..964d63d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +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 diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 871686b..3bb406d 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -1307,11 +1307,9 @@ package body Sem_Ch3 is -- 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)); diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 327bf31..ca54ffc 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -10118,6 +10118,17 @@ package body Sem_Res is 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 |