llvm-project/flang/test/Semantics/omp-depend02.f90
Faris Rehman 6d48a1a53f [flang][driver] Add support for -fopenmp and -fopenacc
Add support for the following options:
* -fopenmp
* -fopenacc

Update OpenMP and OpenACC semantics tests to use the new driver if it is built, otherwise use f18.
OpenMP tests that include `use omp_lib` or run `test_symbols.sh` have not been updated as they require options `-intrinsic-module-directory` and `-funparse-with-symbols` which are currently not implemented in the new driver.
Similarly OpenACC tests that run `test_symbols.sh` have not been updated.

This patch also moves semanticsContext to CompilerInvocation and creates it in CompilerInvocation#setSemanticsOpts so that the semantics context can use Fortran::parser::Options#features.

Summary of changes:
- Move semanticsContext to CompilerInvocation.h
- Update OpenMP and OpenACC semantics tests that do not rely on `-intrinsic-module-directory` and `-funparse-with-symbols` to use %flang

Differential Revision: https://reviews.llvm.org/D96032
2021-02-10 09:59:35 +00:00

50 lines
1.1 KiB
Fortran

! RUN: %S/test_errors.sh %s %t %flang -fopenmp
! OpenMP Version 4.5
! 2.13.9 Depend Clause
! 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
subroutine vec_mult(N)
implicit none
integer :: i, N
real, allocatable :: p(:), v1(:), v2(:)
type my_type
integer :: a(10)
end type my_type
type(my_type) :: my_var
allocate( p(N), v1(N), v2(N) )
!$omp parallel num_threads(2)
!$omp single
!$omp task depend(out:v1)
call init(v1, N)
!$omp end task
!$omp task depend(out:v2)
call init(v2, N)
!$omp end task
!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
!$omp target nowait depend(in:v1,v2, my_var%a) depend(out:p) &
!$omp& map(to:v1,v2) map(from: p)
!$omp parallel do
do i=1,N
p(i) = v1(i) * v2(i)
end do
!$omp end target
!$omp task depend(in:p)
call output(p, N)
!$omp end task
!$omp end single
!$omp end parallel
deallocate( p, v1, v2 )
end subroutine