llvm-project/flang/test/Semantics/OpenMP/loop-transformation-construct04.f90
Krzysztof Parzyszek 499afa6b45
[flang][OpenMP] Check if loop nest/sequence is well-formed (#188025)
Check if the code associated with a nest or sequence construct is well
formed. Emit diagnostic messages if not.

Make a clearer separation for checks of loop-nest-associated and loop-
sequence-associated constructs.

Unify structure of some of the more common messages.

Issue: https://github.com/llvm/llvm-project/issues/185287
2026-03-25 10:29:22 -05:00

50 lines
1.1 KiB
Fortran

! Testing the Semantic failure of forming loop sequences under regular OpenMP directives
!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=60
subroutine loop_transformation_construct3
implicit none
integer, parameter :: i = 5
integer :: x
integer :: v(i)
!ERROR: This construct applies to a loop nest, but has a loop sequence of length 2
!$omp do
!BECAUSE: Out of 3 loops, 2 are fused
!$omp fuse looprange(1,2)
do x = 1, i
v(x) = x * 2
end do
do x = 1, i
v(x) = x * 2
end do
do x = 1, i
v(x) = x * 2
end do
!$omp end fuse
!$omp end do
end subroutine
subroutine loop_transformation_construct4
implicit none
integer, parameter :: i = 5
integer :: x
integer :: v(i)
!ERROR: This construct applies to a loop nest, but has a loop sequence of length 2
!$omp tile sizes(2)
!BECAUSE: Out of 3 loops, 2 are fused
!$omp fuse looprange(1,2)
do x = 1, i
v(x) = x * 2
end do
do x = 1, i
v(x) = x * 2
end do
do x = 1, i
v(x) = x * 2
end do
!$omp end fuse
!$omp end tile
end subroutine