1! { dg-do compile } 2 3module udr7m1 4 type dt 5 real :: r 6 end type dt 7end module udr7m1 8module udr7m2 9 use udr7m1 10 interface operator(+) 11 module procedure addm2 12 end interface 13!$omp declare reduction(+:dt:omp_out=omp_out+omp_in) & 14!$omp & initializer(omp_priv=dt(0.0)) 15!$omp declare reduction(.myadd.:dt:omp_out=omp_out.myadd.omp_in) & 16!$omp & initializer(omp_priv=dt(0.0)) 17 interface operator(.myadd.) 18 module procedure addm2 19 end interface 20 private 21 public :: operator(+), operator(.myadd.), dt 22contains 23 type(dt) function addm2 (x, y) 24 type(dt), intent (in):: x, y 25 addm2%r = x%r + y%r 26 end function 27end module udr7m2 28module udr7m3 29 use udr7m1 30 private 31 public :: operator(.myadd.), operator(+), dt 32 interface operator(.myadd.) 33 module procedure addm3 34 end interface 35!$omp declare reduction(+:dt:omp_out=omp_out+omp_in) & 36!$omp & initializer(omp_priv=dt(0.0)) 37!$omp declare reduction(.myadd.:dt:omp_out=omp_out.myadd.omp_in) & 38!$omp & initializer(omp_priv=dt(0.0)) 39 interface operator(+) 40 module procedure addm3 41 end interface 42contains 43 type(dt) function addm3 (x, y) 44 type(dt), intent (in):: x, y 45 addm3%r = x%r + y%r 46 end function 47end module udr7m3 48module udr7m4 49 use udr7m1 50 private 51 interface operator(.myadd.) 52 module procedure addm4 53 end interface 54!$omp declare reduction(+:dt:omp_out=omp_out+omp_in) & 55!$omp & initializer(omp_priv=dt(0.0)) 56!$omp declare reduction(.myadd.:dt:omp_out=omp_out.myadd.omp_in) & 57!$omp & initializer(omp_priv=dt(0.0)) 58 interface operator(+) 59 module procedure addm4 60 end interface 61contains 62 type(dt) function addm4 (x, y) 63 type(dt), intent (in):: x, y 64 addm4%r = x%r + y%r 65 end function 66end module udr7m4 67subroutine f1 68 use udr7m2 69 type(dt) :: d, e 70 integer :: i 71 d=dt(0.0) 72 e = dt (0.0) 73!$omp parallel do reduction (+ : d) reduction ( .myadd. : e) 74 do i=1,100 75 d=d+dt(i) 76 e=e+dt(i) 77 end do 78end subroutine f1 79subroutine f2 80 use udr7m3 ! { dg-error "Previous !.OMP DECLARE REDUCTION|Ambiguous interfaces" } 81 use udr7m2 ! { dg-error "Ambiguous !.OMP DECLARE REDUCTION" } 82end subroutine f2 83subroutine f3 84 use udr7m4 85 use udr7m2 86end subroutine f3 87subroutine f4 88 use udr7m3 89 use udr7m4 90end subroutine f4 91