crayptr1.f90 901 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ! { dg-do run }
  2. ! { dg-options "-fopenmp -fcray-pointer" }
  3. use omp_lib
  4. integer :: a, b, c, p
  5. logical :: l
  6. pointer (ip, p)
  7. a = 1
  8. b = 2
  9. c = 3
  10. l = .false.
  11. ip = loc (a)
  12. !$omp parallel num_threads (2) reduction (.or.:l)
  13. l = p .ne. 1
  14. !$omp barrier
  15. !$omp master
  16. ip = loc (b)
  17. !$omp end master
  18. !$omp barrier
  19. l = l .or. p .ne. 2
  20. !$omp barrier
  21. if (omp_get_thread_num () .eq. 1 .or. omp_get_num_threads () .lt. 2) &
  22. ip = loc (c)
  23. !$omp barrier
  24. l = l .or. p .ne. 3
  25. !$omp end parallel
  26. if (l) call abort
  27. l = .false.
  28. !$omp parallel num_threads (2) reduction (.or.:l) default (private)
  29. ip = loc (a)
  30. a = 3 * omp_get_thread_num () + 4
  31. b = a + 1
  32. c = a + 2
  33. l = p .ne. 3 * omp_get_thread_num () + 4
  34. ip = loc (c)
  35. l = l .or. p .ne. 3 * omp_get_thread_num () + 6
  36. ip = loc (b)
  37. l = l .or. p .ne. 3 * omp_get_thread_num () + 5
  38. !$omp end parallel
  39. if (l) call abort
  40. end