udr4.f90 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ! { dg-do run }
  2. !$omp declare reduction (foo : character(kind=1, len=*) &
  3. !$omp & : omp_out = fn (omp_out, omp_in)) initializer (omp_priv = '')
  4. !$omp declare reduction (bar : character(kind=1, len=:) &
  5. !$omp & : omp_out = fn (omp_in, omp_out)) initializer (omp_priv = '')
  6. !$omp declare reduction (baz : character(kind=1, len=1) &
  7. !$omp & : omp_out = char (ichar (omp_out) + ichar (omp_in) &
  8. !$omp & - ichar ('0'))) initializer (omp_priv = '0')
  9. !$omp declare reduction (baz : character(kind=1, len=2) &
  10. !$omp & : omp_out = char (ichar (omp_out(1:1)) + ichar (omp_in(1:1)) &
  11. !$omp & - ichar ('0')) // char (ichar (omp_out(2:2)) + &
  12. !$omp & ichar (omp_in(2:2)) - ichar ('0'))) initializer (omp_priv = '00')
  13. interface
  14. elemental function fn (x, y)
  15. character (len=64), intent (in) :: x, y
  16. character (len=64) :: fn
  17. end function
  18. end interface
  19. character(kind=1, len=64) :: c(-3:-2,1:1,7:8), d(2:3,-7:-5)
  20. character(kind = 1, len=1) :: e(2:4)
  21. character(kind = 1, len=1+1) :: f(8:10,9:10)
  22. integer :: i, j, k
  23. c = ''
  24. d = ''
  25. e = '0'
  26. f = '00'
  27. !$omp parallel do reduction (foo : c) reduction (bar : d) &
  28. !$omp & reduction (baz : e, f) private (j, k)
  29. do i = 1, 64
  30. forall (j = -3:-2, k = 7:8) &
  31. c(j,1,k) = trim(c(j,1,k)) // char (ichar ('0') + i)
  32. d = char (ichar ('0') + i) // d
  33. e = char (ichar (e) + mod (i, 3))
  34. f = char (ichar (f(:,:)(1:1)) + mod (i, 2)) &
  35. & // char (ichar (f(:,:)(2:2)) + mod (i, 3))
  36. end do
  37. do i = 1, 64
  38. if (any (index (c, char (ichar ('0') + i)) .eq. 0)) call abort
  39. if (any (index (d, char (ichar ('0') + i)) .eq. 0)) call abort
  40. end do
  41. if (any (e.ne.char (ichar ('0') + 64))) call abort
  42. if (any (f(:,:)(1:1).ne.char (ichar ('0') + 32))) call abort
  43. if (any (f(:,:)(2:2).ne.char (ichar ('0') + 64))) call abort
  44. end
  45. elemental function fn (x, y)
  46. character (len=64), intent (in) :: x, y
  47. character (len=64) :: fn
  48. fn = trim(x) // y
  49. end function