udr3.f90 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ! { dg-do run }
  2. !$omp declare reduction (foo : character(kind=1, len=*) &
  3. !$omp & : omp_out = trim(omp_out) // omp_in) initializer (omp_priv = '')
  4. !$omp declare reduction (bar : character(kind=1, len=:) &
  5. !$omp & : omp_out = trim(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. character(kind=1, len=64) :: c, d
  14. character(kind = 1, len=1) :: e
  15. character(kind = 1, len=1+1) :: f
  16. integer :: i
  17. c = ''
  18. d = ''
  19. e = '0'
  20. f = '00'
  21. !$omp parallel do reduction (foo : c) reduction (bar : d) &
  22. !$omp & reduction (baz : e, f)
  23. do i = 1, 64
  24. c = trim(c) // char (ichar ('0') + i)
  25. d = char (ichar ('0') + i) // d
  26. e = char (ichar (e) + mod (i, 3))
  27. f = char (ichar (f(1:1)) + mod (i, 2)) &
  28. & // char (ichar (f(2:2)) + mod (i, 3))
  29. end do
  30. do i = 1, 64
  31. if (index (c, char (ichar ('0') + i)) .eq. 0) call abort
  32. if (index (d, char (ichar ('0') + i)) .eq. 0) call abort
  33. end do
  34. if (e.ne.char (ichar ('0') + 64)) call abort
  35. if (f(1:1).ne.char (ichar ('0') + 32)) call abort
  36. if (f(2:2).ne.char (ichar ('0') + 64)) call abort
  37. end