Follow-up PR to fix the failure caused here: https://github.com/llvm/llvm-project/pull/121028 Failure: https://lab.llvm.org/buildbot/#/builders/89/builds/14474 Problems: - Cray pointee cannot be used in the DSA list (If used results in segmentation fault) - Cray pointer has to be in the DSA list when Cray pointee is used in the default (none) region Fix: Added required semantic checks along the tests Reference from the documentation (OpenMP 5.0: 2.19.1): - Cray pointees have the same data-sharing attribute as the storage with which their Cray pointers are associated.
45 lines
1.5 KiB
Fortran
45 lines
1.5 KiB
Fortran
!RUN: %python %S/../test_errors.py %s %flang -fopenmp
|
|
subroutine test_cray_pointer_usage
|
|
implicit none
|
|
integer :: i
|
|
real(8) :: var(*), pointee(2)
|
|
pointer(ivar, var)
|
|
! ERROR: Cray Pointee 'var' may not appear in LINEAR clause
|
|
! ERROR: The list item 'var' specified without the REF 'linear-modifier' must be of INTEGER type
|
|
! ERROR: The list item `var` must be a dummy argument
|
|
!$omp declare simd linear(var)
|
|
|
|
pointee = 42.0
|
|
ivar = loc(pointee)
|
|
|
|
!$omp parallel num_threads(2) default(none)
|
|
! ERROR: The DEFAULT(NONE) clause requires that the Cray Pointer 'ivar' must be listed in a data-sharing attribute clause
|
|
print *, var(1)
|
|
!$omp end parallel
|
|
|
|
! ERROR: Cray Pointee 'var' may not appear in PRIVATE clause, use Cray Pointer 'ivar' instead
|
|
!$omp parallel num_threads(2) default(none) private(var)
|
|
print *, var(1)
|
|
!$omp end parallel
|
|
|
|
! ERROR: Cray Pointee 'var' may not appear in SHARED clause, use Cray Pointer 'ivar' instead
|
|
!$omp parallel num_threads(2) default(none) shared(var)
|
|
print *, var(1)
|
|
!$omp end parallel
|
|
|
|
! ERROR: Cray Pointee 'var' may not appear in LASTPRIVATE clause, use Cray Pointer 'ivar' instead
|
|
!$omp do lastprivate(var)
|
|
do i = 1, 10
|
|
print *, var(1)
|
|
end do
|
|
!$omp end do
|
|
|
|
!$omp parallel num_threads(2) default(none) firstprivate(ivar)
|
|
print *, var(1)
|
|
!$omp end parallel
|
|
|
|
!$omp parallel num_threads(2) default(private) shared(ivar)
|
|
print *, var(1)
|
|
!$omp end parallel
|
|
end subroutine test_cray_pointer_usage
|