reduction5.f90 984 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ! { dg-do run }
  2. module reduction5
  3. intrinsic ior, min, max
  4. end module reduction5
  5. call test1
  6. call test2
  7. contains
  8. subroutine test1
  9. use reduction5, bitwise_or => ior
  10. integer :: n
  11. n = Z'f'
  12. !$omp parallel sections num_threads (3) reduction (bitwise_or: n)
  13. n = ior (n, Z'20')
  14. !$omp section
  15. n = bitwise_or (Z'410', n)
  16. !$omp section
  17. n = bitwise_or (n, Z'2000')
  18. !$omp end parallel sections
  19. if (n .ne. Z'243f') call abort
  20. end subroutine
  21. subroutine test2
  22. use reduction5, min => max, max => min
  23. integer :: m, n
  24. m = 8
  25. n = 4
  26. !$omp parallel sections num_threads (3) reduction (min: n) &
  27. !$omp & reduction (max: m)
  28. if (m .gt. 13) m = 13
  29. if (n .lt. 11) n = 11
  30. !$omp section
  31. if (m .gt. 5) m = 5
  32. if (n .lt. 15) n = 15
  33. !$omp section
  34. if (m .gt. 3) m = 3
  35. if (n .lt. -1) n = -1
  36. !$omp end parallel sections
  37. if (m .ne. 3 .or. n .ne. 15) call abort
  38. end subroutine test2
  39. end
  40. ! { dg-final { cleanup-modules "reduction5" } }