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