-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang][OpenMP] Diagnose invalid reduction modifiers (#92406)
Emit diagnostic messages for invalid modifiers in "reduction" clause. Fixes #92397
- Loading branch information
Showing
4 changed files
with
150 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=52 | ||
|
||
subroutine mod_task1(x) | ||
integer, intent(inout) :: x | ||
|
||
!Correct: "parallel" directive. | ||
!$omp parallel reduction(task, +:x) | ||
do i = 1, 100 | ||
x = foo(i) | ||
enddo | ||
!$omp end parallel | ||
end | ||
|
||
subroutine mod_task2(x) | ||
integer, intent(inout) :: x | ||
|
||
!Correct: worksharing directive. | ||
!$omp sections reduction(task, +:x) | ||
do i = 1, 100 | ||
x = foo(i) | ||
enddo | ||
!$omp end sections | ||
end | ||
|
||
subroutine mod_task3(x) | ||
integer, intent(inout) :: x | ||
|
||
!ERROR: Modifier 'TASK' on REDUCTION clause is only allowed with PARALLEL or worksharing directive | ||
!$omp simd reduction(task, +:x) | ||
do i = 1, 100 | ||
x = foo(i) | ||
enddo | ||
!$omp end simd | ||
end | ||
|
||
subroutine mod_inscan1(x) | ||
integer, intent(inout) :: x | ||
|
||
!Correct: worksharing-loop directive | ||
!$omp do reduction(inscan, +:x) | ||
do i = 1, 100 | ||
x = foo(i) | ||
enddo | ||
!$omp end do | ||
end | ||
|
||
subroutine mod_inscan2(x) | ||
integer, intent(inout) :: x | ||
|
||
!Correct: worksharing-loop simd directive | ||
!$omp do simd reduction(inscan, +:x) | ||
do i = 1, 100 | ||
x = foo(i) | ||
enddo | ||
!$omp end do simd | ||
end | ||
|
||
subroutine mod_inscan3(x) | ||
integer, intent(inout) :: x | ||
|
||
!Correct: "simd" directive | ||
!$omp simd reduction(inscan, +:x) | ||
do i = 1, 100 | ||
x = foo(i) | ||
enddo | ||
!$omp end simd | ||
end | ||
|
||
subroutine mod_inscan4(x) | ||
integer, intent(inout) :: x | ||
|
||
!ERROR: Modifier 'INSCAN' on REDUCTION clause is only allowed with worksharing-loop, worksharing-loop simd, or SIMD directive | ||
!$omp parallel reduction(inscan, +:x) | ||
do i = 1, 100 | ||
x = foo(i) | ||
enddo | ||
!$omp end parallel | ||
end | ||
|
||
subroutine mod_inscan5(x) | ||
integer, intent(inout) :: x | ||
|
||
!ERROR: Modifier 'INSCAN' on REDUCTION clause is only allowed with worksharing-loop, worksharing-loop simd, or SIMD directive | ||
!$omp sections reduction(inscan, +:x) | ||
do i = 1, 100 | ||
x = foo(i) | ||
enddo | ||
!$omp end sections | ||
end |