[Ada] CUDA: handle parameter associations in expansion of CUDA_Execute
authorGhjuvan Lacambre <lacambre@adacore.com>
Wed, 23 Sep 2020 07:33:54 +0000 (09:33 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 27 Oct 2020 09:19:31 +0000 (05:19 -0400)
gcc/ada/

* exp_prag.adb (Append_Copies): Handle N_Parameter_Associations.

gcc/ada/exp_prag.adb

index 14ccac9b2a485a210c5f86c01787ba706ec35a2c..53e2d97cd7559ffb9aca275156d0314c1d2bcde9 100644 (file)
@@ -778,16 +778,23 @@ package body Exp_Prag is
       is
          Copy  : Entity_Id;
          Param : Node_Id;
+         Expr  : Node_Id;
       begin
          Param := First (Params);
          while Present (Param) loop
             Copy := Make_Temporary (Loc, 'C');
 
+            if Nkind (Param) = N_Parameter_Association then
+               Expr := Explicit_Actual_Parameter (Param);
+            else
+               Expr := Param;
+            end if;
+
             Append_To (Decls,
                Make_Object_Declaration (Loc,
                  Defining_Identifier => Copy,
-                 Object_Definition   => New_Occurrence_Of (Etype (Param), Loc),
-                 Expression          => New_Copy_Tree (Param)));
+                 Object_Definition   => New_Occurrence_Of (Etype (Expr), Loc),
+                 Expression          => New_Copy_Tree (Expr)));
 
             Append_Elmt (Copy, Copies);
             Next (Param);