brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1001 B · 727a08b Raw
42 lines · plain
1! Test that checks an allocatable array can be marked implicit2! `declare target to` and functions without issue.3! REQUIRES: flang, amdgpu4 5! RUN: %libomptarget-compile-fortran-run-and-check-generic6module test7  implicit none8  integer, allocatable, dimension(:) :: alloca_arr9  !$omp declare target(alloca_arr)10end module test11 12program main13  use test14  implicit none15  integer :: cycle, i16 17  allocate(alloca_arr(10))18 19  do i = 1, 1020      alloca_arr(i) = 021  end do22 23  !$omp target data map(to:alloca_arr)24    do cycle = 1, 225      !$omp target26          do i = 1, 1027              alloca_arr(i) = alloca_arr(i) + i28          end do29      !$omp end target30 31      ! NOTE: Technically doesn't affect the results, but there is a32      ! regression case that'll cause a runtime crash if this is33      ! invoked more than once, so this checks for that.34      !$omp target update from(alloca_arr)35    end do36  !$omp end target data37 38  print *, alloca_arr39end program40 41! CHECK: 2 4 6 8 10 12 14 16 18 2042