gcc/testsuite/gfortran.dg/coarray/collectives_4.f90
raw| 1 | ! { dg-do run } |
| 2 | ! |
| 3 | ! CO_REDUCE |
| 4 | ! |
| 5 | implicit none (type, external) |
| 6 | intrinsic :: co_reduce |
| 7 | integer :: stat |
| 8 | integer :: i4, i4_2, i |
| 9 | |
| 10 | i4 = 21 * this_image() |
| 11 | i4_2 = 21 |
| 12 | do i = 2, num_images() |
| 13 | i4_2 = i4_2 * 21 * i |
| 14 | end do |
| 15 | call co_reduce(i4, op_i4, stat=stat) |
| 16 | if (stat /= 0) STOP 1 |
| 17 | if (i4_2 /= i4) STOP 2 |
| 18 | |
| 19 | contains |
| 20 | pure integer function op_i4(a,b) |
| 21 | integer, value :: a, b |
| 22 | op_i4 = a * b |
| 23 | end function op_i4 |
| 24 | end |