brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · ed0a1d2 Raw
65 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=502! OpenMP Version 5.03! 2.10.1 use_device_ptr clause4! 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 in7! use_device_addr clause.8! Same list item can not be present multiple times or in multipe9! USE_DEVICE_PTR clauses.10 11subroutine omp_target_data12   use iso_c_binding13   integer :: a(1024)14   type(C_PTR) :: b15   integer, pointer :: arrayB16   type my_type17    type(C_PTR) :: my_cptr18   end type my_type19 20   type(my_type) :: my_var21   a = 122 23   !ERROR: A variable that is part of another variable cannot appear on the USE_DEVICE_PTR clause24   !$omp target data map(tofrom: a, arrayB) use_device_ptr(my_var%my_cptr)25      allocate(arrayB)26      call c_f_pointer(my_var%my_cptr, arrayB)27      a = arrayB28   !$omp end target data29 30   !WARNING: Use of non-C_PTR type 'a' in USE_DEVICE_PTR is deprecated, use USE_DEVICE_ADDR instead [-Wopen-mp-usage]31   !$omp target data map(tofrom: a) use_device_ptr(a)32      a = 233   !$omp end target data34 35   !ERROR: List item 'b' present at multiple USE_DEVICE_PTR clauses36   !$omp target data map(tofrom: a, arrayB) use_device_ptr(b) use_device_ptr(b)37      allocate(arrayB)38      call c_f_pointer(b, arrayB)39      a = arrayB40   !$omp end target data41 42   !ERROR: List item 'b' present at multiple USE_DEVICE_PTR clauses43   !$omp target data map(tofrom: a, arrayB) use_device_ptr(b,b)44      allocate(arrayB)45      call c_f_pointer(b, arrayB)46      a = arrayB47   !$omp end target data48 49   !ERROR: Variable 'b' may not appear on both USE_DEVICE_PTR and USE_DEVICE_ADDR clauses on a TARGET DATA construct50   !$omp target data map(tofrom: a, arrayB) use_device_addr(b) use_device_ptr(b)51      allocate(arrayB)52      call c_f_pointer(b, arrayB)53      a = arrayB54   !$omp end target data55 56   !ERROR: Variable 'b' may not appear on both USE_DEVICE_PTR and USE_DEVICE_ADDR clauses on a TARGET DATA construct57   !$omp target data map(tofrom: a, arrayB) use_device_ptr(b) use_device_addr(b)58      allocate(arrayB)59      call c_f_pointer(b, arrayB)60      a = arrayB61   !$omp end target data62 63end subroutine omp_target_data64 65