From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id C7D53385843A; Wed, 6 Jul 2022 13:30:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C7D53385843A MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1521] [Ada] Incorrect emptying of CUDA global subprograms X-Act-Checkin: gcc X-Git-Author: Justin Squirek X-Git-Refname: refs/heads/master X-Git-Oldrev: 405ebd743d392d2b0afd384e0955e3922e388ca9 X-Git-Newrev: 614c45555a11a658f0c9639afb67d1d4bbb3454f Message-Id: <20220706133026.C7D53385843A@sourceware.org> Date: Wed, 6 Jul 2022 13:30:26 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2022 13:30:26 -0000 https://gcc.gnu.org/g:614c45555a11a658f0c9639afb67d1d4bbb3454f commit r13-1521-g614c45555a11a658f0c9639afb67d1d4bbb3454f Author: Justin Squirek Date: Fri Jun 10 12:16:17 2022 +0000 [Ada] Incorrect emptying of CUDA global subprograms This patch corrects an error in the compiler whereby no Corresponding_Spec was set for emptied CUDA global subprograms - leading to a malformed tree. gcc/ada/ * gnat_cuda.adb (Empty_CUDA_Global_Subprogram): Set Specification and Corresponding_Spec to match the original Kernel_Body. Diff: --- gcc/ada/gnat_cuda.adb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/ada/gnat_cuda.adb b/gcc/ada/gnat_cuda.adb index 44394b73163..3391263afed 100644 --- 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);