Files
llvm/offload/test/offloading/fortran/implicit-map-allocatable-field.f90
agozillon a929f4af39 [Flang][OpenMP] Remove target implicit allocatable member mapping from MapInfoFinalization and extend lowering to support it (#219434)
This PR aims to remove the partially implemented implicit allocatable
member mapping code from MapInfoFinalization, and move it to the
lowering.

The MapInfoFinalization code should no longer be required as the
DeclareMapper infrastructure in the frontend is capable of handling
these cases now and already does so for the majority of them, so we are
better consolidating the implementation to one location and extending it
to support more cases.

This PR removes the old code from MapInfoFinalization, and enables the
default declare mapper generation that handles most other implicit
mapping cases for derived types in the initial lowering to handle the
previously supported cases and more.

The implicit default declare mapper generation has been modified to only
map the necessary bits of a derived type, which are record types (to
hold any nested mappers and to make sure we map all non-allocatable
bits, including descriptors) and the data for any allocatable bits
(specifically just the ref_ptee and then an attach emission).
2026-09-11 05:43:39 +02:00

31 lines
610 B
Fortran

! Verify that a derived type with an allocatable component, captured implicitly
! by a target region, is correctly mapped to and from the device.
! REQUIRES: flang, amdgpu
! RUN: %libomptarget-compile-fortran-run-and-check-generic
program p
implicit none
type t
integer, allocatable :: a(:)
end type
type(t) :: x
allocate(x%a(1))
x%a = 0
!$omp target
x%a(1) = 42
!$omp end target
if (x%a(1) /= 42) then
print *, "======= Test Failed! ======="
stop 1
end if
print *, "======= Test Passed! ======="
deallocate(x%a)
end program
! CHECK: ======= Test Passed! =======