1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=50
3 ! 2.10.1 use_device_ptr clause
4 ! List item in USE_DEVICE_PTR clause must not be structure element.
5 ! List item in USE_DEVICE_PTR clause must be of type C_PTR.
6 ! List items that appear in a use_device_ptr clause can not appear in
7 ! use_device_addr clause.
8 ! Same list item can not be present multiple times or in multipe
9 ! USE_DEVICE_PTR clauses.
11 subroutine omp_target_data
15 integer, pointer :: arrayB
17 type(C_PTR
) :: my_cptr
20 type(my_type
) :: my_var
23 !ERROR: A variable that is part of another variable (structure element) cannot appear on the TARGET DATA USE_DEVICE_PTR clause
24 !$omp target data map(tofrom: a, arrayB) use_device_ptr(my_var%my_cptr)
26 call c_f_pointer(my_var
%my_cptr
, arrayB
)
30 !WARNING: Use of non-C_PTR type 'a' in USE_DEVICE_PTR is deprecated, use USE_DEVICE_ADDR instead
31 !$omp target data map(tofrom: a) use_device_ptr(a)
35 !ERROR: List item 'b' present at multiple USE_DEVICE_PTR clauses
36 !$omp target data map(tofrom: a, arrayB) use_device_ptr(b) use_device_ptr(b)
38 call c_f_pointer(b
, arrayB
)
42 !ERROR: List item 'b' present at multiple USE_DEVICE_PTR clauses
43 !$omp target data map(tofrom: a, arrayB) use_device_ptr(b,b)
45 call c_f_pointer(b
, arrayB
)
49 !ERROR: Variable 'b' may not appear on both USE_DEVICE_PTR and USE_DEVICE_ADDR clauses on a TARGET DATA construct
50 !$omp target data map(tofrom: a, arrayB) use_device_addr(b) use_device_ptr(b)
52 call c_f_pointer(b
, arrayB
)
56 !ERROR: Variable 'b' may not appear on both USE_DEVICE_PTR and USE_DEVICE_ADDR clauses on a TARGET DATA construct
57 !$omp target data map(tofrom: a, arrayB) use_device_ptr(b) use_device_addr(b)
59 call c_f_pointer(b
, arrayB
)
63 end subroutine omp_target_data