https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92920
Bug ID: 92920
Summary: [OpenMP][OpenACC] Implicit mapping of character
scalars (nonalloc/nonptr) – shall be firstprivate not
tofrom
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: openacc, openmp
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
Related: PR 92568 and possibly PR 92568.
Per OpenMP 4.5, just before 2.15.5.1 or OpenMP 5, 2.19.7,
https://www.openmp.org/spec-html/5.0/openmpsu109.html#x142-6180002.19.7
Implicit mapping of scalar variables uses firstprivate, unless they have the
(OpenMP 5:) allocatable or pointer attribute or (OpenMP 4.5 or 5:) the
defaultmap clause says something different.
Currently, gfortran handles character strings as non-scalar:
character :: c
c = 'a'
!$omp target
c = 'b'
!$omp end target
print *, c ! shows 'b' due to 'tofrom' mapping; instead of 'a' w/ firstprivate
end
OpenACC 2.7 has in "2.5.2. Kernels Construct":
"A scalar variable referenced in the kernels construct that does not appear in
a data clause for the construct or any enclosing data construct will be treated
as if it appeared in a copy clause."