public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Incorrect emptying of CUDA global subprograms
@ 2022-07-06 13:31 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-06 13:31 UTC (permalink / raw)
  To: gcc-patches; +Cc: Justin Squirek

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

This patch corrects an error in the compiler whereby no
Corresponding_Spec was set for emptied CUDA global subprograms - leading
to a malformed tree.

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

gcc/ada/

	* gnat_cuda.adb (Empty_CUDA_Global_Subprogram): Set
	Specification and Corresponding_Spec to match the original
	Kernel_Body.

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

diff --git a/gcc/ada/gnat_cuda.adb b/gcc/ada/gnat_cuda.adb
--- a/gcc/ada/gnat_cuda.adb
+++ b/gcc/ada/gnat_cuda.adb
@@ -165,17 +165,20 @@ package body GNAT_CUDA is
 
       Kernel_Elm := First_Elmt (Kernels);
       while Present (Kernel_Elm) loop
-         Kernel := Node (Kernel_Elm);
+         Kernel      := Node (Kernel_Elm);
          Kernel_Body := Subprogram_Body (Kernel);
-         Loc := Sloc (Kernel_Body);
+         Loc         := Sloc (Kernel_Body);
 
          Null_Body := Make_Subprogram_Body (Loc,
-           Specification              => Subprogram_Specification (Kernel),
+           Specification              => Specification (Kernel_Body),
            Declarations               => New_List,
            Handled_Statement_Sequence =>
              Make_Handled_Sequence_Of_Statements (Loc,
                Statements => New_List (Make_Null_Statement (Loc))));
 
+         Set_Corresponding_Spec (Null_Body,
+           Corresponding_Spec (Kernel_Body));
+
          Rewrite (Kernel_Body, Null_Body);
 
          Next_Elmt (Kernel_Elm);



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

only message in thread, other threads:[~2022-07-06 13:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 13:31 [Ada] Incorrect emptying of CUDA global subprograms Pierre-Marie de Rodat

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).