b605f6639c
2016-06-03 Chung-Lin Tang <cltang@codesourcery.com> c/ * c-typeck.c (c_finish_omp_clauses): Mark OpenACC reduction arguments as addressable when async clause exists. cp/ * semantics.c (finish_omp_clauses): Mark OpenACC reduction arguments as addressable when async clause exists. fortran/ * trans-openmp.c (gfc_trans_omp_reduction_list): Add mark_addressable bool parameter, set reduction clause DECLs as addressable when true. (gfc_trans_omp_clauses): Pass clauses->async to gfc_trans_omp_reduction_list, add comment describing OpenACC situation. libgomp/ * testsuite/libgomp.oacc-fortran/reduction-8.f90: New testcase. * testsuite/libgomp.oacc-c-c++-common/reduction-8.c: New testcase. From-SVN: r237070
42 lines
682 B
Fortran
42 lines
682 B
Fortran
! { dg-do run }
|
|
|
|
program reduction
|
|
implicit none
|
|
integer, parameter :: n = 100
|
|
integer :: i, h1, h2, s1, s2, a1, a2
|
|
|
|
h1 = 0
|
|
h2 = 0
|
|
do i = 1, n
|
|
h1 = h1 + 1
|
|
h2 = h2 + 2
|
|
end do
|
|
|
|
s1 = 0
|
|
s2 = 0
|
|
!$acc parallel loop reduction(+:s1, s2)
|
|
do i = 1, n
|
|
s1 = s1 + 1
|
|
s2 = s2 + 2
|
|
end do
|
|
!$acc end parallel loop
|
|
|
|
a1 = 0
|
|
a2 = 0
|
|
!$acc parallel loop reduction(+:a1, a2) async(1)
|
|
do i = 1, n
|
|
a1 = a1 + 1
|
|
a2 = a2 + 2
|
|
end do
|
|
!$acc end parallel loop
|
|
|
|
if (h1 .ne. s1) call abort ()
|
|
if (h2 .ne. s2) call abort ()
|
|
|
|
!$acc wait(1)
|
|
|
|
if (h1 .ne. a1) call abort ()
|
|
if (h2 .ne. a2) call abort ()
|
|
|
|
end program reduction
|