| 1 |
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=52 |
| 2 |
|
| 3 |
subroutine mod_task1(x) |
| 4 |
integer, intent(inout) :: x |
| 5 |
|
| 6 |
!Correct: "parallel" directive. |
| 7 |
!$omp parallel reduction(task, +:x) |
| 8 |
do i = 1, 100 |
| 9 |
x = foo(i) |
| 10 |
enddo |
| 11 |
!$omp end parallel |
| 12 |
end |
| 13 |
|
| 14 |
subroutine mod_task2(x) |
| 15 |
integer, intent(inout) :: x |
| 16 |
|
| 17 |
!Correct: worksharing directive. |
| 18 |
!$omp sections reduction(task, +:x) |
| 19 |
do i = 1, 100 |
| 20 |
x = foo(i) |
| 21 |
enddo |
| 22 |
!$omp end sections |
| 23 |
end |
| 24 |
|
| 25 |
subroutine mod_task3(x) |
| 26 |
integer, intent(inout) :: x |
| 27 |
|
| 28 |
!ERROR: Modifier 'TASK' on REDUCTION clause is only allowed with PARALLEL or worksharing directive |
| 29 |
!$omp simd reduction(task, +:x) |
| 30 |
do i = 1, 100 |
| 31 |
x = foo(i) |
| 32 |
enddo |
| 33 |
!$omp end simd |
| 34 |
end |
| 35 |
|
| 36 |
subroutine mod_inscan1(x) |
| 37 |
integer, intent(inout) :: x |
| 38 |
|
| 39 |
!Correct: worksharing-loop directive |
| 40 |
!$omp do reduction(inscan, +:x) |
| 41 |
do i = 1, 100 |
| 42 |
x = foo(i) |
| 43 |
enddo |
| 44 |
!$omp end do |
| 45 |
end |
| 46 |
|
| 47 |
subroutine mod_inscan2(x) |
| 48 |
integer, intent(inout) :: x |
| 49 |
|
| 50 |
!Correct: worksharing-loop simd directive |
| 51 |
!$omp do simd reduction(inscan, +:x) |
| 52 |
do i = 1, 100 |
| 53 |
x = foo(i) |
| 54 |
enddo |
| 55 |
!$omp end do simd |
| 56 |
end |
| 57 |
|
| 58 |
subroutine mod_inscan3(x) |
| 59 |
integer, intent(inout) :: x |
| 60 |
|
| 61 |
!Correct: "simd" directive |
| 62 |
!$omp simd reduction(inscan, +:x) |
| 63 |
do i = 1, 100 |
| 64 |
x = foo(i) |
| 65 |
enddo |
| 66 |
!$omp end simd |
| 67 |
end |
| 68 |
|
| 69 |
subroutine mod_inscan4(x) |
| 70 |
integer, intent(inout) :: x |
| 71 |
|
| 72 |
!ERROR: Modifier 'INSCAN' on REDUCTION clause is only allowed with worksharing-loop, worksharing-loop simd, or SIMD directive |
| 73 |
!$omp parallel reduction(inscan, +:x) |
| 74 |
do i = 1, 100 |
| 75 |
x = foo(i) |
| 76 |
enddo |
| 77 |
!$omp end parallel |
| 78 |
end |
| 79 |
|
| 80 |
subroutine mod_inscan5(x) |
| 81 |
integer, intent(inout) :: x |
| 82 |
|
| 83 |
!ERROR: Modifier 'INSCAN' on REDUCTION clause is only allowed with worksharing-loop, worksharing-loop simd, or SIMD directive |
| 84 |
!$omp sections reduction(inscan, +:x) |
| 85 |
do i = 1, 100 |
| 86 |
x = foo(i) |
| 87 |
enddo |
| 88 |
!$omp end sections |
| 89 |
end |