target5.f90 393 B

12345678910111213141516171819202122
  1. ! { dg-do compile }
  2. ! { dg-options "-fopenmp" }
  3. integer :: r
  4. r = 0
  5. call foo (r)
  6. if (r /= 11) call abort
  7. contains
  8. subroutine foo (r)
  9. integer :: i, r
  10. !$omp parallel
  11. !$omp single
  12. !$omp target teams distribute parallel do reduction (+: r)
  13. do i = 1, 10
  14. r = r + 1
  15. end do
  16. r = r + 1
  17. !$omp end single
  18. !$omp end parallel
  19. end subroutine
  20. end