aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/map-subarray-5.f90
blob: e7cdf11e6108a8fc645164ada77a6f8ab98882e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
! { dg-do run }

type t
  integer, pointer :: p(:)
end type t

type(t) :: var(3)
integer :: i, j

allocate (var(1)%p, source=[1,2,3,5])
allocate (var(2)%p, source=[2,3,5])
allocate (var(3)%p(1:3))

var(3)%p = 0

do i = 1, 3
  do j = 1, 3
!$omp target map(var(i)%p, var(j)%p)
    var(i)%p(1) = 5
    var(j)%p(2) = 7
!$omp end target

    if (i.ne.j) then
!$omp target map(var(i)%p(1:3), var(i)%p, var(j)%p)
      var(i)%p(1) = var(i)%p(1) + 1
      var(j)%p(2) = var(j)%p(2) + 1
!$omp end target

!$omp target map(var(i)%p, var(j)%p, var(j)%p(1:3))
      var(i)%p(1) = var(i)%p(1) + 1
      var(j)%p(2) = var(j)%p(2) + 1
!$omp end target

!$omp target map(var(i)%p, var(i)%p(1:3), var(j)%p, var(j)%p(2))
      var(i)%p(1) = var(i)%p(1) + 1
      var(j)%p(2) = var(j)%p(2) + 1
!$omp end target
    end if

    if (i.eq.j) then
      if (var(i)%p(1).ne.5) stop 1
      if (var(j)%p(2).ne.7) stop 2
    else
      if (var(i)%p(1).ne.8) stop 3
      if (var(j)%p(2).ne.10) stop 4
    end if
  end do
end do

end

! { dg-output "(\n|\r|\r\n)" }
! { dg-output "libgomp: Mapped array elements must be the same .*(\n|\r|\r\n)+" }
! { dg-shouldfail "" { offload_device_nonshared_as } }