aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@adacore.com>2021-07-27 12:23:23 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-09-23 13:06:14 +0000
commitfb3f21a3df8062a7a209b385aae377de2d8c093e (patch)
tree764a089f5736b94e2ee5c20a299b739793628612 /gcc
parente2b2f629da02f9b2549db7297133166f721953ae (diff)
downloadgcc-fb3f21a3df8062a7a209b385aae377de2d8c093e.zip
gcc-fb3f21a3df8062a7a209b385aae377de2d8c093e.tar.gz
gcc-fb3f21a3df8062a7a209b385aae377de2d8c093e.tar.bz2
[Ada] If unnesting and relocating subprogram call, make new Parameter_Associations
gcc/ada/ * atree.adb (Relocate_Node): If relocating a subprgram call and we're doing unnesting, make a new Parameter_Associations, if any.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/atree.adb16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index 00565d6..e7fa8e0 100644
--- 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;