libgomp/testsuite/libgomp.fortran/target-in-reduction-2.f90
raw| 1 | ! { dg-do run } |
| 2 | |
| 3 | program main |
| 4 | integer :: x |
| 5 | |
| 6 | x = 0 |
| 7 | !$omp taskgroup task_reduction (+: x) |
| 8 | call foo (x) |
| 9 | call bar (x) |
| 10 | !$omp end taskgroup |
| 11 | |
| 12 | if (x .ne. 3) stop 1 |
| 13 | |
| 14 | contains |
| 15 | |
| 16 | subroutine foo (x) |
| 17 | integer :: x |
| 18 | !$omp task in_reduction (+: x) |
| 19 | x = x + 1 |
| 20 | !$omp end task |
| 21 | end subroutine foo |
| 22 | |
| 23 | subroutine bar (x) |
| 24 | integer :: x |
| 25 | !$omp target in_reduction (+: x) |
| 26 | x = x + 2 |
| 27 | !$omp end target |
| 28 | end subroutine bar |
| 29 | |
| 30 | end program main |