On 30.09.22 15:30, Julian Brown wrote:
On Fri, 23 Sep 2022 14:10:51 +0200 Tobias Burnus 
<tob...@codesourcery.com><mailto:tob...@codesourcery.com> wrote:
...
I added n->expr->expr_type == EXPR_VARIABLE to the condition -- I think
that should suffice for now?

Yes.


A similar mean way to write code would be:

integer, target :: A(5)
integer, pointer :: p(:), p2(:)
type(t) :: var

allocate(p2(1:20))
p => A
var%p2 => p2
!$omp target map(A(3:4), p2(4:8), p, var%p2)
 ....
!$omp end target

which has a similar issue – it is not clear from the syntax whether
p's or var%p2's pointer target has been mapped or not.


Again, I don't think you're allowed to write that: that's "different
list items" sharing the same "original storage", IIUC. (It'd be nice to
diagnose it at compile time, but that's probably not that easy...)

Hmm, isn't that implied to be valid per:

"[Fortran] If a list item in a map clause is an associated pointer and the 
pointer
is not the base pointer of another list item in a map clause on the same
construct, then it is treated as if its pointer target is implicitly
mapped in the same clause."
(OpenMP 5.2, 5.8.3 map Clause [152:1-4]; seems to be identical to
OpenMP 5.1, 2.21.7.1 map Clause [349:9-12])

Admittedly, in 5.0 I only see the wording (OpenMP 5.0, [316:22-25]),
which is also not handled - but different:

"[Fortran] Each pointer component that is a list item that results from
a mapped derived type variable is treated as if its association status
is undefined, unless the pointer component appears as another list
item or as the base pointer of another list item in a map clause on
the same construct."

I think the that's for the following case (which is also covered by the
more general 5.1/5.2 wording):
type t

 integer, pointer :: p(:)
 integer, pointer :: p2(:)
end type t
type(t) :: var
integer, target :: tgt(5), tgt2(1000)
var%p => tgt
var%p => tgt2

!$omp target map(tgt, tgt2(4:6), var)
 var%p(1) = 5
 var%p2(5) = 7
!$omp end target

and I think GCC does not handled this, but I might be wrong.

Tobias


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to