From: Pierre-Marie de Rodat <derodat@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Richard Kenner <kenner@adacore.com>
Subject: [Ada] If unnesting and relocating subprogram call, make new Parameter_Associations
Date: Thu, 23 Sep 2021 13:12:35 +0000 [thread overview]
Message-ID: <20210923131235.GA2727155@adacore.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 388 bytes --]
When unnesting, we may add static links to the actual parameters. This
will cause duplication if a the Parameter_Associations list is shared,
so ensure that we make a new one in this situation.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* atree.adb (Relocate_Node): If relocating a subprgram call and
we're doing unnesting, make a new Parameter_Associations, if
any.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 879 bytes --]
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -1962,6 +1962,22 @@ package body Atree is
Set_Original_Node (New_Node, Original_Node (Source));
end if;
+ -- If we're relocating a subprogram call and we're doing
+ -- unnesting, be sure we make a new copy of any parameter associations
+ -- so that we don't share them.
+
+ if Nkind (Source) in N_Subprogram_Call
+ and then Opt.Unnest_Subprogram_Mode
+ and then Present (Parameter_Associations (Source))
+ then
+ declare
+ New_Assoc : constant List_Id := Parameter_Associations (Source);
+ begin
+ Set_Parent (New_Assoc, New_Node);
+ Set_Parameter_Associations (New_Node, New_Assoc);
+ end;
+ end if;
+
return New_Node;
end Relocate_Node;
reply other threads:[~2021-09-23 13:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210923131235.GA2727155@adacore.com \
--to=derodat@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=kenner@adacore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).