53 lines · plain
1! Test implicit mapping of alloctable record fields.2 3! REQUIRES: flang, amdgpu4 5! This fails only because it needs the Fortran runtime built for device. If this6! is available, this test succeeds when run.7! XFAIL: *8 9! RUN: %libomptarget-compile-fortran-generic10! RUN: env LIBOMPTARGET_INFO=16 %libomptarget-run-generic 2>&1 | %fcheck-generic11program test_implicit_field_mapping12 implicit none13 14 type record_t15 real, allocatable :: not_to_implicitly_map(:)16 real, allocatable :: to_implicitly_map(:)17 end type18 19 type(record_t) :: dst_record20 real :: src_array(10)21 real :: dst_sum, src_sum22 integer :: i23 24 call random_number(src_array)25 dst_sum = 026 src_sum = 027 28 do i=1,1029 src_sum = src_sum + src_array(i)30 end do31 print *, "src_sum=", src_sum32 33 !$omp target map(from: dst_sum)34 dst_record%to_implicitly_map = src_array35 dst_sum = 036 37 do i=1,1038 dst_sum = dst_sum + dst_record%to_implicitly_map(i)39 end do40 !$omp end target41 42 print *, "dst_sum=", dst_sum43 44 if (src_sum == dst_sum) then45 print *, "Test succeeded!"46 else47 print *, "Test failed!", " dst_sum=", dst_sum, "vs. src_sum=", src_sum48 endif49end program50 51! CHECK: "PluginInterface" device {{[0-9]+}} info: Launching kernel {{.*}}52! CHECK: Test succeeded!53