llvm-project/flang/test/Semantics/OpenMP/cray-pointer-usage.f90
Krzysztof Parzyszek c7a4785d60 Revert "[flang][OpenMP] Analyze objects in OmpObjectList on clauses (#155424)"
This reverts commit 63085310c9290336ff190ed911f59fc172e32b6c.

This breaks gfortran test suite:

```
error: Semantic errors in gfortran/regression/gomp/pr80918.f90
gfortran/regression/gomp/pr80918.f90:6:27: error: Whole assumed-size array 'a' may not appear here without subscripts
    !$omp task depend(inout:a)
                            ^
gfortran/regression/gomp/pr80918.f90:5:14: Declaration of 'a'
    integer :: a(*)
               ^
```

The error appears to be legitimate.
2025-08-27 10:11:44 -05:00

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