forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Flang][OpenMP] Add semantic check for OpenMP Private, Firstprivate a…
…nd Lastprivate clauses. OpenMP 4.5 - Variables that appear in expressions for statement function definitions may not appear in OpenMP Private, Firstprivate or Lastprivate clauses. Test case : omp-private03.f90 Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D93213
- Loading branch information
1 parent
893c84d
commit a2ca6bb
Showing
2 changed files
with
71 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
! RUN: %S/test_errors.sh %s %t %f18 -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 |