From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 85F753858C2B; Mon, 15 May 2023 09:31:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85F753858C2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684143069; bh=s2Zfx2hCeJqDbi0SArVej2b5dRYP+ejMqjVGBK0tNm0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MhjyAw/GFSkvK+HMG39JrBB4GgtuVw3rPSMzcqD3wcphGR9tp1kqvSPxiGKEU2Z+e gCXcwqRHC1lBwTZQQS+UpfxOdo+7gly4VU3/qy1OR6KOdxPPdMsk4w2ylzTa8ngDoB YRhk76XesTNZealULML7soCwGNXHmCCnBkXVP3QQ= From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/109837] [OpenMP] despite 'requires unified_address' there is segfault when 'is_device_ptr' is not used Date: Mon, 15 May 2023 09:31:08 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgomp X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109837 --- Comment #1 from Tobias Burnus --- Minor correction/clarification: (B) omp_target_is_accessible - will properly work for such pointers. While it might be useful to handle also (C/C++) code like: ptr =3D omp_target_alloc (...); ... is_accessible =3D omp_target_is_accessible(ptr, ...); The OpenMP spec only requires: "The *omp_target_is_accessible* routine tests whether host memory is access= ible from a given device." And "ptr" is a device pointer. Thus, returning FALSE for all such pointers, unless in shared memory, is OK. =E2=86=92 Still, we might consider to add checking for memory that is both = host and device accessible - or is a device pointer in the unified-address case. (Quality of Implementation Feature). * * * Besides 'is_device_ptr', the same is required for has_device_addr like in (Fortran): c_ptr =3D omp_alloc(...) call c_f_pointer (c_ptr, fptr) !$omp target fptr =3D ... [That has_device_addr is not mentioned for 'requires unified_addr' is the OpenMP Spec Issue #3606.]=