| 1 |
! RUN: %python %S/../test_errors.py %s %flang -fopenacc |
| 2 |
|
| 3 |
! Check OpenACC clause validity for the following construct and directive: |
| 4 |
! 2.10 Cache |
| 5 |
|
| 6 |
program openacc_cache_validity |
| 7 |
|
| 8 |
implicit none |
| 9 |
|
| 10 |
type atype |
| 11 |
real(8), dimension(10) :: arr |
| 12 |
real(8) :: s |
| 13 |
end type atype |
| 14 |
|
| 15 |
integer :: i |
| 16 |
integer, parameter :: N = 256 |
| 17 |
real(8), dimension(N, N) :: aa |
| 18 |
type(atype) :: t |
| 19 |
type(atype), dimension(10) :: ta |
| 20 |
real(8), dimension(N) :: a |
| 21 |
|
| 22 |
do i = 1, N |
| 23 |
|
| 24 |
!$acc cache(a(i)) |
| 25 |
!$acc cache(a(1:2,3:4)) |
| 26 |
!$acc cache(a) |
| 27 |
!$acc cache(readonly: a, aa) |
| 28 |
!$acc cache(readonly: a(i), aa(i, i)) |
| 29 |
!$acc cache(t%arr) |
| 30 |
!$acc cache(ta(1:2)%arr) |
| 31 |
!$acc cache(ta(1:2)%arr(1:4)) |
| 32 |
!$acc cache(i) |
| 33 |
!$acc cache(t%s) |
| 34 |
|
| 35 |
!ERROR: Only array element or subarray are allowed in CACHE directive |
| 36 |
!$acc cache(t) |
| 37 |
|
| 38 |
!ERROR: Only array element or subarray are allowed in CACHE directive |
| 39 |
!$acc cache(/i/) |
| 40 |
|
| 41 |
end do |
| 42 |
|
| 43 |
!ERROR: The CACHE directive must be inside a loop |
| 44 |
!$acc cache(a) |
| 45 |
|
| 46 |
end program openacc_cache_validity |