https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92568
Bug ID: 92568 Summary: OpenMP 5 - implicit mapping of scalar with TARGET/ALLOCATABLE/POINTER attribute: shall be 'tofrom' mapped Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: openmp Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org CC: jakub at gcc dot gnu.org Target Milestone: --- The following program correctly maps 'var' as firstprivate, but wrongly maps 'err' also as firstprivate - it should be 'tofrom' because of the TARGET attribute. (Likewise with allocatable or pointer attribute.) Cf. OpenMP 5, 2.19.7, last two bullet points. In OpenMP 4.5 (2.19.7), all scalars are firstprivate - independ of their attributes, unless a defaultmap clause required something else. (Hence, the current implementation is fine for OpenMP 4.5.) Side note: the defaultmap clause, new in OpenMP 4.5, is also not yet supported in gfortran. implicit none (type, external) integer, target :: err integer :: var err = 42 var = 53 !$OMP target ! implied mapping tofrom for 'err' (because of target) ! implied mapping firstprivate for 'var' err = 0 if (var /= 53) err = 1 var = 10 !$OMP end target if (err /= 0 .or. var /= 53) error stop 1 end