llvm-project/flang/test/Semantics/OpenACC/acc-cache-validity.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

44 lines
1.0 KiB
Fortran

! RUN: %S/../test_errors.sh %s %t %flang -fopenacc
! Check OpenACC clause validity for the following construct and directive:
! 2.10 Cache
program openacc_cache_validity
implicit none
type atype
real(8), dimension(10) :: arr
real(8) :: s
end type atype
integer :: i
integer, parameter :: N = 256
real(8), dimension(N, N) :: aa
type(atype) :: t
type(atype), dimension(10) :: ta
real(8), dimension(N) :: a
!$acc cache(a(i))
!$acc cache(a(1:2,3:4))
!$acc cache(a)
!$acc cache(readonly: a, aa)
!$acc cache(readonly: a(i), aa(i, i))
!$acc cache(t%arr)
!$acc cache(ta(1:2)%arr)
!$acc cache(ta(1:2)%arr(1:4))
!ERROR: Only array element or subarray are allowed in CACHE directive
!$acc cache(ta(1:2)%s)
!ERROR: Only array element or subarray are allowed in CACHE directive
!$acc cache(i)
!ERROR: Only array element or subarray are allowed in CACHE directive
!$acc cache(t%s)
!ERROR: Only array element or subarray are allowed in CACHE directive
!$acc cache(/i/)
end program openacc_cache_validity