Anchu Rajendran S a51d263282
Adding warning for Master as it is deprecated in 5.2 (#98955)
Since `master` is deprecated from OpenMP spec 5.2, warning is added.
Using `masked` is the recommended alternative as per spec
2024-07-23 09:19:54 -07: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