From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id EEE1E385840C; Mon, 24 Oct 2022 19:48:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EEE1E385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666640912; bh=7DVesFTS/CwFHsXrZZ2a+o6xd706Ap1eOPuQQXYJtGE=; h=From:To:Subject:Date:From; b=IE08hFELbe+GRT61HkU8qOYv4+kk0uKDe+KGUiBJT+XVgajMmACvYFobv+Rfax8pg ouMF5tSBqw1LvzXooMRj0onbTTo/Rg6zRG3SqeCqDPh1uaEyERLBuqcmGQt3V05MC8 88vdy1cI0rWAWhvxVrGZYnGwjrm6WXNquYQviQWw= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3464] libgomp/nvptx: Prepare for reverse-offload callback handling, resolve spurious SIGSEGVs X-Act-Checkin: gcc X-Git-Author: Thomas Schwinge X-Git-Refname: refs/heads/master X-Git-Oldrev: f751bf4c5d1aaa1aacfcbdec62881c5ea1175dfb X-Git-Newrev: 205538832b7033699047900cf25928f5920d8b93 Message-Id: <20221024194832.EEE1E385840C@sourceware.org> Date: Mon, 24 Oct 2022 19:48:28 +0000 (GMT) List-Id: https://gcc.gnu.org/g:205538832b7033699047900cf25928f5920d8b93 commit r13-3464-g205538832b7033699047900cf25928f5920d8b93 Author: Thomas Schwinge Date: Mon Oct 24 21:11:47 2022 +0200 libgomp/nvptx: Prepare for reverse-offload callback handling, resolve spurious SIGSEGVs Per commit r13-3460-g131d18e928a3ea1ab2d3bf61aa92d68a8a254609 "libgomp/nvptx: Prepare for reverse-offload callback handling", I'm seeing a lot of libgomp execution test regressions. Random example, 'libgomp.c-c++-common/error-1.c': [...] GOMP_OFFLOAD_run: kernel main$_omp_fn$0: launch [(teams: 1), 1, 1] [(lanes: 32), (threads: 8), 1] Thread 1 "a.out" received signal SIGSEGV, Segmentation fault. 0x00007ffff793b87d in GOMP_OFFLOAD_run (ord=, tgt_fn=, tgt_vars=, args=) at [...]/source-gcc/libgomp/plugin/plugin-nvptx.c:2127 2127 if (__atomic_load_n (&ptx_dev->rev_data->fn, __ATOMIC_ACQUIRE) != 0) (gdb) print ptx_dev $1 = (struct ptx_device *) 0x6a55a0 (gdb) print ptx_dev->rev_data $2 = (struct rev_offload *) 0xffffffff00000000 (gdb) print ptx_dev->rev_data->fn Cannot access memory at address 0xffffffff00000000 libgomp/ * plugin/plugin-nvptx.c (nvptx_open_device): Initialize 'ptx_dev->rev_data'. Diff: --- libgomp/plugin/plugin-nvptx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index ad057edabec..0768fca350b 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -546,6 +546,8 @@ nvptx_open_device (int n) ptx_dev->omp_stacks.size = 0; pthread_mutex_init (&ptx_dev->omp_stacks.lock, NULL); + ptx_dev->rev_data = NULL; + return ptx_dev; }