xref: /llvm-project/flang/test/Semantics/OpenACC/acc-host-data.f90 (revision 6c1ac141d3c98af9738bc77fcb55602cbff7751f)
1! RUN: %python %S/../test_errors.py %s %flang -fopenacc
2
3! Check OpenACC clause validity for the following construct and directive:
4!   2.8 host_data
5
6program openacc_host_data_validity
7
8  implicit none
9
10  integer, parameter :: N = 256
11  real(8), dimension(N, N) :: aa, bb
12  logical :: ifCondition = .TRUE.
13
14  !ERROR: At least one of USE_DEVICE clause must appear on the HOST_DATA directive
15  !$acc host_data
16  !$acc end host_data
17
18  !$acc host_data use_device(aa)
19  !$acc end host_data
20
21  !$acc host_data use_device(aa) if(.true.)
22  !$acc end host_data
23
24  !$acc host_data use_device(aa) if(ifCondition)
25  !$acc end host_data
26
27  !$acc host_data use_device(aa, bb) if_present
28  !$acc end host_data
29
30  !ERROR: At most one IF_PRESENT clause can appear on the HOST_DATA directive
31  !$acc host_data use_device(aa, bb) if_present if_present
32  !$acc end host_data
33
34  !$acc host_data use_device(aa, bb) if(.true.) if_present
35  !$acc end host_data
36
37  !ERROR: At most one IF clause can appear on the HOST_DATA directive
38  !$acc host_data use_device(aa, bb) if(.true.) if(ifCondition)
39  !$acc end host_data
40
41end program openacc_host_data_validity
42