https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92730

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Common blocks behave kind of oddly, depending on whether implicit mapping is
used or not:

integer :: a, b, c, d, e, i
common /blk/ a,b,c

! comment:
!$omp declare target enter(/blk/)

a = 1; b = 2; c = 5

!$omp target enter data map(to: i, b, e)
!$omp target map(always, present, to: b,i,e)
  print '(z16)', loc(i)
  print '(z16)', loc(b)
  print '(z16)', loc(e)
  print *, b
  b = 99
!$omp end target

! uncomment
!$omp target !!map(present, alloc: b)
  print '(z16)', loc(a)
  print '(z16)', loc(b)
  print '(z16)', loc(c)
  print *, a, b, c
!$omp end target
end

* * *

Per discussion for of the OpenMP specification (Issue 3433) the consensus was:

- for map(a,b,c), map(/blk/), map(a) – one gets individual mapping (not
necessarily contiguous)

- With 'declare target enter(/blk/)' on gets a contiguous chunk of memory

- With 'omp target enter data map(b)' one then updates an individual member.

It seems as if GCC currently does does a mix of the two rather randomly – and
'map(/blk/)' is not supported (= main topic of this PR.)

Reply via email to