reduction4.f90 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ! { dg-do run }
  2. !$ use omp_lib
  3. integer (kind = 4) :: i, ia (6), j, ja (6), k, ka (6), ta (6), n, cnt, x
  4. logical :: v
  5. i = Z'ffff0f'
  6. ia = Z'f0ff0f'
  7. j = Z'0f0000'
  8. ja = Z'0f5a00'
  9. k = Z'055aa0'
  10. ka = Z'05a5a5'
  11. v = .false.
  12. cnt = -1
  13. x = not(0)
  14. !$omp parallel num_threads (3) private (n) reduction (.or.:v) &
  15. !$omp & reduction (iand:i, ia) reduction (ior:j, ja) reduction (ieor:k, ka)
  16. !$ if (i .ne. x .or. any (ia .ne. x)) v = .true.
  17. !$ if (j .ne. 0 .or. any (ja .ne. 0)) v = .true.
  18. !$ if (k .ne. 0 .or. any (ka .ne. 0)) v = .true.
  19. n = omp_get_thread_num ()
  20. if (n .eq. 0) then
  21. cnt = omp_get_num_threads ()
  22. i = Z'ff7fff'
  23. ia(3:5) = Z'fffff1'
  24. j = Z'078000'
  25. ja(1:3) = 1
  26. k = Z'78'
  27. ka(3:6) = Z'f0f'
  28. else if (n .eq. 1) then
  29. i = Z'ffff77'
  30. ia(2:5) = Z'ffafff'
  31. j = Z'007800'
  32. ja(2:5) = 8
  33. k = Z'57'
  34. ka(3:4) = Z'f0108'
  35. else
  36. i = Z'777fff'
  37. ia(1:2) = Z'fffff3'
  38. j = Z'000780'
  39. ja(5:6) = Z'f00'
  40. k = Z'1000'
  41. ka(6:6) = Z'777'
  42. end if
  43. !$omp end parallel
  44. if (v) call abort
  45. if (cnt .eq. 3) then
  46. ta = (/Z'f0ff03', Z'f0af03', Z'f0af01', Z'f0af01', Z'f0af01', Z'f0ff0f'/)
  47. if (i .ne. Z'777f07' .or. any (ia .ne. ta)) call abort
  48. ta = (/Z'f5a01', Z'f5a09', Z'f5a09', Z'f5a08', Z'f5f08', Z'f5f00'/)
  49. if (j .ne. Z'fff80' .or. any (ja .ne. ta)) call abort
  50. ta = (/Z'5a5a5', Z'5a5a5', Z'aaba2', Z'aaba2', Z'5aaaa', Z'5addd'/)
  51. if (k .ne. Z'54a8f' .or. any (ka .ne. ta)) call abort
  52. end if
  53. end