Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / depend02.f90
blob76c02c8f9cbabe415ad7b66e2097c1cf098bb71b
1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2 ! OpenMP Version 4.5
3 ! 2.13.9 Depend Clause
4 ! A variable that is part of another variable
5 ! (such as an element of a structure) but is not an array element or
6 ! an array section cannot appear in a DEPEND clause
8 subroutine vec_mult(N)
9 implicit none
10 integer :: i, N
11 real, allocatable :: p(:), v1(:), v2(:)
13 type my_type
14 integer :: a(10)
15 end type my_type
17 type(my_type) :: my_var
18 allocate( p(N), v1(N), v2(N) )
20 !$omp parallel num_threads(2)
21 !$omp single
23 !$omp task depend(out:v1)
24 call init(v1, N)
25 !$omp end task
27 !$omp task depend(out:v2)
28 call init(v2, N)
29 !$omp end task
31 !ERROR: A variable that is part of another variable (such as an element of a structure) but is not an array element or an array section cannot appear in a DEPEND clause
32 !$omp target nowait depend(in:v1,v2, my_var%a) depend(out:p) &
33 !$omp& map(to:v1,v2) map(from: p)
34 !$omp parallel do
35 do i=1,N
36 p(i) = v1(i) * v2(i)
37 end do
38 !$omp end target
40 !$omp task depend(in:p)
41 call output(p, N)
42 !$omp end task
44 !$omp end single
45 !$omp end parallel
47 deallocate( p, v1, v2 )
49 end subroutine