summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.fortran/crayptr2.f90
blob: 4ad7cf228b6501946627d8e33b7a94dd63eed82e (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
! { dg-do run }
! { dg-options "-fopenmp -fcray-pointer" }
! { dg-require-effective-target tls_runtime }

  use omp_lib
  integer :: a, b, c, d, p
  logical :: l
  pointer (ip, p)
  save ip
!$omp threadprivate (ip)
  a = 1
  b = 2
  c = 3
  l = .false.
!$omp parallel num_threads (3) reduction (.or.:l)
  if (omp_get_thread_num () .eq. 0) then
    ip = loc (a)
  elseif (omp_get_thread_num () .eq. 1) then
    ip = loc (b)
  else
    ip = loc (c)
  end if
  l = p .ne. omp_get_thread_num () + 1
!$omp single
  d = omp_get_thread_num ()
!$omp end single copyprivate (d, ip)
  l = l .or. (p .ne. d + 1)
!$omp end parallel

  if (l) call abort
end