https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122910
Bug ID: 122910
Summary: [OpenMP] 'firstprivate' on 'target' mishandled –
should privatize pointer not (also) the pointee
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: openmp, wrong-code
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
Testcase:
https://github.com/OpenMP-Validation-and-Verification/OpenMP_VV/blob/master/tests/5.1/target/test_target_is_accessible.F90
For
! Assume the device can access host memory
! If you don't have one, try OMP_OFFLOAD_TARGET=disabled (hostfallback)
INTEGER, POINTER :: fptr(:)
integer, parameter :: N = 5
ALLOCATE(fptr(N))
fptr = 0
!$omp target firstprivate(fptr)
DO i=1, N
fptr(i) = 5*i
END DO
!$omp end target
print *, fptr
end
GCC privatizes the pointee, i.e. it prints 0 instead of 5*i.
OpenMP - here TR14 - requires (at least meanwhile):
"7.3.4 firstprivate Clause
"If an original list item has the POINTER attribute, the new list
items receive the same association status as the original list item,
as if by pointer assignment."