diff options
author | Justin Squirek <squirek@adacore.com> | 2022-08-18 19:48:22 +0000 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2022-09-06 09:14:22 +0200 |
commit | c66e69f33744e897c64a16e78ba893d1ea439139 (patch) | |
tree | a4e428a3f8d71c30c5913d5c29929f5d94064baf | |
parent | d644c519672601c7a2c1627a875dcd8e16aed9c9 (diff) | |
download | gcc-c66e69f33744e897c64a16e78ba893d1ea439139.zip gcc-c66e69f33744e897c64a16e78ba893d1ea439139.tar.gz gcc-c66e69f33744e897c64a16e78ba893d1ea439139.tar.bz2 |
[Ada] Handle new At_End expansion during unnesting
This patch modifies the marking of nested subprograms requiring static links,
so that the changes made to "At end" procedures get handled properly.
gcc/ada/
* exp_unst.adb
(Visit_Node): Add N_Block_Statement to the enclosing construct
case since they can now have "At end" procedures. Also, recognize
calls from "At end" procedures when recording subprograms.
-rw-r--r-- | gcc/ada/exp_unst.adb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index 2fb9299..1297f28 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -938,7 +938,7 @@ package body Exp_Unst is -- subprogram. As above, the called entity must be local and -- not imported. - when N_Handled_Sequence_Of_Statements => + when N_Handled_Sequence_Of_Statements | N_Block_Statement => if Present (At_End_Proc (N)) and then Scope_Within (Entity (At_End_Proc (N)), Subp) and then not Is_Imported (Entity (At_End_Proc (N))) @@ -1184,6 +1184,15 @@ package body Exp_Unst is Register_Subprogram (Ent, N); + -- Record a call from an At_End_Proc + + if Present (At_End_Proc (N)) + and then Scope_Within (Entity (At_End_Proc (N)), Subp) + and then not Is_Imported (Entity (At_End_Proc (N))) + then + Append_Unique_Call ((N, Ent, Entity (At_End_Proc (N)))); + end if; + -- We make a recursive call to scan the subprogram body, so -- that we can save and restore Current_Subprogram. |