1! PR fortran/27395 2! { dg-do run } 3 4program pr27395_1 5 implicit none 6 integer, parameter :: n=10,m=1001 7 integer :: i 8 integer, dimension(n) :: sumarray 9 call foo(n,m,sumarray) 10 do i=1,n 11 if (sumarray(i).ne.m*i) call abort 12 end do 13end program pr27395_1 14 15subroutine foo(n,m,sumarray) 16 use omp_lib, only : omp_get_thread_num 17 implicit none 18 integer, intent(in) :: n,m 19 integer, dimension(n), intent(out) :: sumarray 20 integer :: i,j 21 sumarray(:)=0 22!$OMP PARALLEL DEFAULT(shared) NUM_THREADS(4) 23!$OMP DO PRIVATE(j,i), REDUCTION(+:sumarray) 24 do j=1,m 25 do i=1,n 26 sumarray(i)=sumarray(i)+i 27 end do 28 end do 29!$OMP END DO 30!$OMP END PARALLEL 31end subroutine foo 32