llvm-project/flang/test/Semantics/OpenMP/test_taskloop_reduction_semantic_restrictions.f90
sharang.12492 7eb8b73178
[Flang][OpenMP][taskloop] Adding missing semantic checks in Taskloop (#128431)
Below semantic checks for Taskloop clause mentioned in OpenMP [5.2]
specification were missing, this patch contains the semantic checks,
corresponding error messages and test cases:
OpenMP standard [5.2]:
[12.6] Taskloop Construct
[Restrictions]
Restrictions to the taskloop construct are as follows: 
• The reduction-modifier must be default.
• The conditional lastprivate-modifier must not be specified.

Authored-by: shkaushi <sharang.kaushik@amd.com>
2025-03-17 12:35:37 +05:30

25 lines
583 B
Fortran

!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=52
subroutine bar()
integer :: x, i
x = 1
!ERROR: REDUCTION modifier on TASKLOOP directive must be DEFAULT
!ERROR: List item x must appear in EXCLUSIVE or INCLUSIVE clause of an enclosed SCAN directive
!$omp taskloop reduction(inscan, +:x)
do i = 1, 100
x = x + 1
enddo
!$omp end taskloop
end
subroutine baz()
integer :: x, i
x = 1
!ERROR: REDUCTION modifier on TASKLOOP directive must be DEFAULT
!$omp taskloop reduction(task, +:x)
do i = 1, 100
x = x + 1
enddo
!$omp end taskloop
end