Files
clang-p2996/flang/test/Semantics/OpenMP/nested-teams.f90
Kiran Chandramohan 092a819e94 [Flang][OpenMP] Add frontend support for directives involving master (#113893)
Issue deprecation warning for these directives.
Lowering currently supports parallel master, for all other combined or
composite directives involving master, issue TODO errors.

Note: The first commit changes the formatting and generalizes the
deprecation message emission for reuse in the second commit. I can pull
it out into a separate commit if required.
2024-10-30 10:58:26 +00:00

114 lines
2.8 KiB
Fortran

! RUN: %python %S/../test_errors.py %s %flang -fopenmp
! OpenMP Version 5.0
! Check OpenMP construct validity for the following directives:
! 2.7 Teams Construct
program main
integer :: i, j, N = 10
real :: a, b, c
!$omp teams
a = 3.14
!$omp end teams
!$omp target
!$omp teams
a = 3.14
!$omp end teams
!$omp end target
!$omp target
!$omp parallel
!ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
!$omp teams
a = 3.14
!$omp end teams
!$omp end parallel
!$omp end target
!$omp parallel
!ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
!$omp teams
a = 3.14
!$omp end teams
!$omp end parallel
!$omp do
do i = 1, N
!ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
!$omp teams
a = 3.14
!$omp end teams
end do
!WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead.
!$omp master
!ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
!$omp teams
a = 3.14
!$omp end teams
!$omp end master
!$omp target parallel
!ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
!$omp teams
a = 3.14
!$omp end teams
!$omp end target parallel
!$omp target
!$omp teams
!ERROR: Only `DISTRIBUTE` or `PARALLEL` regions are allowed to be strictly nested inside `TEAMS` region.
!ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
!$omp teams
a = 3.14
!$omp end teams
!$omp end teams
!$omp end target
!$omp target teams
!ERROR: TEAMS region can only be strictly nested within the implicit parallel region or TARGET region
!$omp teams
a = 3.14
!$omp end teams
!$omp end target teams
!ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct
!$omp target
do i = 1, N
!$omp teams
a = 3.14
!$omp end teams
enddo
!$omp end target
!ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct
!$omp target
if (i .GT. 1) then
if (j .GT. 1) then
!$omp teams
a = 3.14
!$omp end teams
end if
end if
!$omp end target
!ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct
!$omp target
b = 3.14
!$omp teams
a = 3.14
!$omp end teams
!$omp end target
!ERROR: TARGET construct with nested TEAMS region contains statements or directives outside of the TEAMS construct
!$omp target
!$omp teams
a = 3.14
!$omp end teams
c = 3.14
!$omp end target
end program main