xref: /llvm-project/offload/test/offloading/fortran/target-map-derived-type-full-implicit-1.f90 (revision 372344995568cae076477a8b0e98fcdec7c49379)
1! Offloading test checking interaction of an implicit derived type mapping when
2! mapped to target and assinging one derived type to another
3! REQUIRES: flang, amdgpu
4
5! RUN: %libomptarget-compile-fortran-run-and-check-generic
6program main
7    type :: scalar
8    integer(4) :: ix = 0
9    real(4) :: rx = 0.0
10    complex(4) :: zx = (0,0)
11    end type scalar
12
13    type(scalar) :: in
14    type(scalar) :: out
15    in%ix = 10
16    in%rx = 2.0
17    in%zx = (2, 10)
18
19  !$omp target map(from:out)
20      out = in
21  !$omp end target
22
23    print*, in%ix
24    print*, in%rx
25    write (*,*) in%zx
26
27    print*, out%ix
28    print*, out%rx
29    write (*,*)  out%zx
30  end program main
31
32!CHECK: 10
33!CHECK: 2.
34!CHECK: (2.,10.)
35!CHECK: 10
36!CHECK: 2.
37!CHECK: (2.,10.)
38