vla7.f90 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. ! { dg-do run }
  2. ! { dg-options "-w" }
  3. character (6) :: c, f2
  4. character (6) :: d(2)
  5. c = f1 (6)
  6. if (c .ne. 'opqrst') call abort
  7. c = f2 (6)
  8. if (c .ne. '_/!!/_') call abort
  9. d = f3 (6)
  10. if (d(1) .ne. 'opqrst' .or. d(2) .ne. 'a') call abort
  11. d = f4 (6)
  12. if (d(1) .ne. 'Opqrst' .or. d(2) .ne. 'A') call abort
  13. contains
  14. function f1 (n)
  15. use omp_lib
  16. character (n) :: f1
  17. logical :: l
  18. f1 = 'abcdef'
  19. l = .false.
  20. !$omp parallel firstprivate (f1) reduction (.or.:l) num_threads (2)
  21. l = f1 .ne. 'abcdef'
  22. if (omp_get_thread_num () .eq. 0) f1 = 'ijklmn'
  23. if (omp_get_thread_num () .eq. 1) f1 = 'IJKLMN'
  24. !$omp barrier
  25. l = l .or. (omp_get_thread_num () .eq. 0 .and. f1 .ne. 'ijklmn')
  26. l = l .or. (omp_get_thread_num () .eq. 1 .and. f1 .ne. 'IJKLMN')
  27. !$omp end parallel
  28. f1 = 'zZzz_z'
  29. !$omp parallel shared (f1) reduction (.or.:l) num_threads (2)
  30. l = l .or. f1 .ne. 'zZzz_z'
  31. !$omp barrier
  32. !$omp master
  33. f1 = 'abc'
  34. !$omp end master
  35. !$omp barrier
  36. l = l .or. f1 .ne. 'abc'
  37. !$omp barrier
  38. if (omp_get_thread_num () .eq. 1) f1 = 'def'
  39. !$omp barrier
  40. l = l .or. f1 .ne. 'def'
  41. !$omp end parallel
  42. if (l) call abort
  43. f1 = 'opqrst'
  44. end function f1
  45. function f3 (n)
  46. use omp_lib
  47. character (n), dimension (2) :: f3
  48. logical :: l
  49. f3 = 'abcdef'
  50. l = .false.
  51. !$omp parallel firstprivate (f3) reduction (.or.:l) num_threads (2)
  52. l = any (f3 .ne. 'abcdef')
  53. if (omp_get_thread_num () .eq. 0) f3 = 'ijklmn'
  54. if (omp_get_thread_num () .eq. 1) f3 = 'IJKLMN'
  55. !$omp barrier
  56. l = l .or. (omp_get_thread_num () .eq. 0 .and. any (f3 .ne. 'ijklmn'))
  57. l = l .or. (omp_get_thread_num () .eq. 1 .and. any (f3 .ne. 'IJKLMN'))
  58. !$omp end parallel
  59. f3 = 'zZzz_z'
  60. !$omp parallel shared (f3) reduction (.or.:l) num_threads (2)
  61. l = l .or. any (f3 .ne. 'zZzz_z')
  62. !$omp barrier
  63. !$omp master
  64. f3 = 'abc'
  65. !$omp end master
  66. !$omp barrier
  67. l = l .or. any (f3 .ne. 'abc')
  68. !$omp barrier
  69. if (omp_get_thread_num () .eq. 1) f3 = 'def'
  70. !$omp barrier
  71. l = l .or. any (f3 .ne. 'def')
  72. !$omp end parallel
  73. if (l) call abort
  74. f3(1) = 'opqrst'
  75. f3(2) = 'a'
  76. end function f3
  77. function f4 (n)
  78. use omp_lib
  79. character (n), dimension (n - 4) :: f4
  80. logical :: l
  81. f4 = 'abcdef'
  82. l = .false.
  83. !$omp parallel firstprivate (f4) reduction (.or.:l) num_threads (2)
  84. l = any (f4 .ne. 'abcdef')
  85. if (omp_get_thread_num () .eq. 0) f4 = 'ijklmn'
  86. if (omp_get_thread_num () .eq. 1) f4 = 'IJKLMN'
  87. !$omp barrier
  88. l = l .or. (omp_get_thread_num () .eq. 0 .and. any (f4 .ne. 'ijklmn'))
  89. l = l .or. (omp_get_thread_num () .eq. 1 .and. any (f4 .ne. 'IJKLMN'))
  90. l = l .or. size (f4) .ne. 2
  91. !$omp end parallel
  92. f4 = 'zZzz_z'
  93. !$omp parallel shared (f4) reduction (.or.:l) num_threads (2)
  94. l = l .or. any (f4 .ne. 'zZzz_z')
  95. !$omp barrier
  96. !$omp master
  97. f4 = 'abc'
  98. !$omp end master
  99. !$omp barrier
  100. l = l .or. any (f4 .ne. 'abc')
  101. !$omp barrier
  102. if (omp_get_thread_num () .eq. 1) f4 = 'def'
  103. !$omp barrier
  104. l = l .or. any (f4 .ne. 'def')
  105. l = l .or. size (f4) .ne. 2
  106. !$omp end parallel
  107. if (l) call abort
  108. f4(1) = 'Opqrst'
  109. f4(2) = 'A'
  110. end function f4
  111. end
  112. function f2 (n)
  113. use omp_lib
  114. character (*) :: f2
  115. logical :: l
  116. f2 = 'abcdef'
  117. l = .false.
  118. !$omp parallel firstprivate (f2) reduction (.or.:l) num_threads (2)
  119. l = f2 .ne. 'abcdef'
  120. if (omp_get_thread_num () .eq. 0) f2 = 'ijklmn'
  121. if (omp_get_thread_num () .eq. 1) f2 = 'IJKLMN'
  122. !$omp barrier
  123. l = l .or. (omp_get_thread_num () .eq. 0 .and. f2 .ne. 'ijklmn')
  124. l = l .or. (omp_get_thread_num () .eq. 1 .and. f2 .ne. 'IJKLMN')
  125. !$omp end parallel
  126. f2 = 'zZzz_z'
  127. !$omp parallel shared (f2) reduction (.or.:l) num_threads (2)
  128. l = l .or. f2 .ne. 'zZzz_z'
  129. !$omp barrier
  130. !$omp master
  131. f2 = 'abc'
  132. !$omp end master
  133. !$omp barrier
  134. l = l .or. f2 .ne. 'abc'
  135. !$omp barrier
  136. if (omp_get_thread_num () .eq. 1) f2 = 'def'
  137. !$omp barrier
  138. l = l .or. f2 .ne. 'def'
  139. !$omp end parallel
  140. if (l) call abort
  141. f2 = '_/!!/_'
  142. end function f2