xref: /llvm-project/flang/test/Semantics/OpenMP/target01.f90 (revision 00ab44ee66dbcf0d32819dbc6e4eefd1b7c48dfa)
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=51
2
3subroutine foo(b)
4use iso_c_binding
5integer :: x,y
6type(C_PTR) :: b
7!ERROR: Variable 'x' may not appear on both MAP and PRIVATE clauses on a TARGET construct
8!$omp target map(x) private(x)
9  x = x + 1
10!$omp end target
11
12!ERROR: Variable 'y' in IS_DEVICE_PTR clause must be of type C_PTR
13!$omp target map(x) is_device_ptr(y)
14  x = x + 1
15!$omp end target
16
17!ERROR: Variable 'b' may not appear on both IS_DEVICE_PTR and HAS_DEVICE_ADDR clauses on a TARGET construct
18!$omp target map(x) is_device_ptr(b) has_device_addr(b)
19  x = x + 1
20!$omp end target
21
22!ERROR: Variable 'b' may not appear on both IS_DEVICE_PTR and PRIVATE clauses on a TARGET construct
23!$omp target map(x) is_device_ptr(b) private(b)
24  x = x + 1
25!$omp end target
26
27!ERROR: Variable 'y' may not appear on both HAS_DEVICE_ADDR and FIRSTPRIVATE clauses on a TARGET construct
28!$omp target map(x) has_device_addr(y) firstprivate(y)
29  y = y - 1
30!$omp end target
31
32end subroutine foo
33
34subroutine bar(b1, b2, b3)
35  use iso_c_binding
36  integer :: y
37  type(c_ptr) :: c
38  type(c_ptr), allocatable :: b1
39  type(c_ptr), pointer :: b2
40  type(c_ptr), value :: b3
41
42  !WARNING: Variable 'c' in IS_DEVICE_PTR clause must be a dummy argument. This semantic check is deprecated from OpenMP 5.2 and later.
43  !$omp target is_device_ptr(c)
44    y = y + 1
45  !$omp end target
46  !WARNING: Variable 'b1' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later.
47  !$omp target is_device_ptr(b1)
48    y = y + 1
49  !$omp end target
50  !WARNING: Variable 'b2' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later.
51  !$omp target is_device_ptr(b2)
52    y = y + 1
53  !$omp end target
54  !WARNING: Variable 'b3' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later.
55  !$omp target is_device_ptr(b3)
56    y = y + 1
57  !$omp end target
58end subroutine bar
59