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
40 lines
1005 B
Fortran
40 lines
1005 B
Fortran
! RUN: %S/test_errors.sh %s %t %flang -fopenmp
|
|
! OpenMP Version 4.5
|
|
! Variables that appear in expressions for statement function definitions
|
|
! may not appear in private, firstprivate or lastprivate clauses.
|
|
|
|
subroutine stmt_function(temp)
|
|
|
|
integer :: i, p, q, r
|
|
real :: c, f, s, v, t(10)
|
|
real, intent(in) :: temp
|
|
|
|
c(temp) = p * (temp - q) / r
|
|
f(temp) = q + (temp * r/p)
|
|
v(temp) = c(temp) + f(temp)/2 - s
|
|
|
|
p = 5
|
|
q = 32
|
|
r = 9
|
|
|
|
!ERROR: Variable 'p' in STATEMENT FUNCTION expression cannot be in a PRIVATE clause
|
|
!$omp parallel private(p)
|
|
s = c(temp)
|
|
!$omp end parallel
|
|
|
|
!ERROR: Variable 's' in STATEMENT FUNCTION expression cannot be in a FIRSTPRIVATE clause
|
|
!$omp parallel firstprivate(s)
|
|
s = s + f(temp)
|
|
!$omp end parallel
|
|
|
|
!ERROR: Variable 's' in STATEMENT FUNCTION expression cannot be in a LASTPRIVATE clause
|
|
!$omp parallel do lastprivate(s, t)
|
|
do i = 1, 10
|
|
t(i) = v(temp) + i - s
|
|
end do
|
|
!$omp end parallel do
|
|
|
|
print *, t
|
|
|
|
end subroutine stmt_function
|