]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/ada/sem_util.adb
[Ada] Missing attribute update in new_copy_tree
[thirdparty/gcc.git] / gcc / ada / sem_util.adb
index f837b6fd91214e4f6ca5721797ae99bcd1636455..58b7b0864ee9cb1109db578aecf9fa93cafb2d5d 100644 (file)
@@ -20623,6 +20623,10 @@ package body Sem_Util is
          Old_Next : Node_Id;
 
       begin
+         if No (First_Named_Actual (Old_Call)) then
+            return;
+         end if;
+
          --  Recreate the First/Next_Named_Actual chain of a call by traversing
          --  the chains of both the old and new calls in parallel.
 
@@ -20630,15 +20634,16 @@ package body Sem_Util is
          Old_Act := First (Parameter_Associations (Old_Call));
          while Present (Old_Act) loop
             if Nkind (Old_Act) = N_Parameter_Association
-              and then Present (Next_Named_Actual (Old_Act))
+              and then Explicit_Actual_Parameter (Old_Act)
+                         = First_Named_Actual (Old_Call)
             then
-               if First_Named_Actual (Old_Call) =
-                    Explicit_Actual_Parameter (Old_Act)
-               then
-                  Set_First_Named_Actual (New_Call,
-                    Explicit_Actual_Parameter (New_Act));
-               end if;
+               Set_First_Named_Actual (New_Call,
+                 Explicit_Actual_Parameter (New_Act));
+            end if;
 
+            if Nkind (Old_Act) = N_Parameter_Association
+              and then Present (Next_Named_Actual (Old_Act))
+            then
                --  Scan the actual parameter list to find the next suitable
                --  named actual. Note that the list may be out of order.