public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Handle new At_End expansion during unnesting
@ 2022-09-06  7:15 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2022-09-06  7:15 UTC (permalink / raw)
  To: gcc-patches; +Cc: Justin Squirek

[-- Attachment #1: Type: text/plain, Size: 416 bytes --]

This patch modifies the marking of nested subprograms requiring static links,
so that the changes made to "At end" procedures get handled properly.

Tested on x86_64-pc-linux-gnu, committed on trunk

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.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1246 bytes --]

diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb
--- 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.
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-06  7:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06  7:15 [Ada] Handle new At_End expansion during unnesting Marc Poulhiès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).