xref: /llvm-project/offload/test/offloading/fortran/target-map-derived-type-full-implicit-2.f90 (revision 372344995568cae076477a8b0e98fcdec7c49379)
1! Offloading test checking interaction of an explicit 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    integer(4) :: array(5)
12    end type scalar
13
14    type(scalar) :: out
15    type(scalar) :: in
16
17    in%ix = 10
18    in%rx = 2.0
19    in%zx = (2, 10)
20
21    do i = 1, 5
22      in%array(i) = i
23    end do
24
25  !$omp target
26    out%ix = in%ix
27    out%rx = in%rx
28    out%zx = in%zx
29
30    do i = 1, 5
31      out%array(i) = in%array(i)
32    end do
33  !$omp end target
34
35    print*, in%ix
36    print*, in%rx
37    print*, in%array
38    write (*,*) in%zx
39
40    print*, out%ix
41    print*, out%rx
42    print*, out%array
43    write (*,*)  out%zx
44end program main
45
46!CHECK: 10
47!CHECK: 2.
48!CHECK: 1 2 3 4 5
49!CHECK: (2.,10.)
50!CHECK: 10
51!CHECK: 2.
52!CHECK: 1 2 3 4 5
53!CHECK: (2.,10.)
54