Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / workshare05.f90
blobb57053e092e67bcbe1dc8f55dd29bca90ecea9fd
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2 ! OpenMP Version 4.5
3 ! 2.7.4 workshare Construct
4 ! Checks for OpenMP Parallel constructs enclosed in Workshare constructs
6 module workshare_mod
7 interface assignment(=)
8 module procedure work_assign
9 end interface
11 contains
12 subroutine work_assign(a,b)
13 integer, intent(out) :: a
14 logical, intent(in) :: b(:)
15 end subroutine work_assign
17 integer function my_func()
18 my_func = 10
19 end function my_func
21 end module workshare_mod
23 program omp_workshare
24 use workshare_mod
26 integer, parameter :: n = 10
27 integer :: i, j, a(10), b(10)
28 integer, pointer :: p
29 integer, target :: t
30 logical :: l(10)
31 real :: aa(n,n), bb(n,n), cc(n,n), dd(n,n), ee(n,n), ff(n,n)
33 !$omp workshare
35 !$omp parallel
36 p => t
37 a = l
38 !$omp single
39 ee = ff
40 !$omp end single
41 !$omp end parallel
43 !ERROR: A worksharing region may not be closely nested inside a worksharing, explicit task, taskloop, critical, ordered, atomic, or master region
44 !$omp parallel sections
45 !$omp section
46 aa = my_func()
47 !$omp end parallel sections
49 !$omp parallel do
50 do i = 1, 10
51 b(i) = my_func() + i
52 end do
53 !$omp end parallel do
55 !$omp parallel
56 where (dd .lt. 5) dd = aa * my_func()
57 !$omp end parallel
59 !$omp end workshare
61 end program omp_workshare