1! { dg-do run } 2 3module udr1 4 type dt 5 integer :: x = 7 6 integer :: y = 9 7 end type 8end module udr1 9 use udr1, only : dt 10!$omp declare reduction (foo : integer : omp_out = omp_out + omp_in) 11 integer :: i, j 12!$omp declare reduction (bar : integer : & 13!$omp & omp_out = omp_out + iand (omp_in, -4)) initializer (omp_priv = 3) 14 type (dt) :: d 15!$omp declare reduction (+ : dt : omp_out%x = omp_out%x & 16!$omp & + iand (omp_in%x, -8)) 17!$omp declare reduction (foo : dt : omp_out%x = iand (omp_in%x, -8) & 18!$omp & + omp_out%x) initializer (omp_priv = dt (5, 21)) 19 interface operator (+) 20 function notdefined(x, y) 21 use udr1, only : dt 22 type(dt), intent (in) :: x, y 23 type(dt) :: notdefined 24 end function 25 end interface 26 j = 0 27!$omp parallel do reduction (foo : j) 28 do i = 1, 100 29 j = j + i 30 end do 31 if (j .ne. 5050) STOP 1 32 j = 3 33!$omp parallel do reduction (bar : j) 34 do i = 1, 100 35 j = j + 4 * i 36 end do 37 if (j .ne. (5050 * 4 + 3)) STOP 2 38!$omp parallel do reduction (+ : d) 39 do i = 1, 100 40 if (d%y .ne. 9) STOP 3 41 d%x = d%x + 8 * i 42 end do 43 if (d%x .ne. (5050 * 8 + 7) .or. d%y .ne. 9) STOP 4 44 d = dt (5, 21) 45!$omp parallel do reduction (foo : d) 46 do i = 1, 100 47 if (d%y .ne. 21) STOP 5 48 d%x = d%x + 8 * i 49 end do 50 if (d%x .ne. (5050 * 8 + 5) .or. d%y .ne. 21) STOP 6 51end 52