Debian Codegraph @

gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_3.f03

raw
1 ! { dg-do run }
2 !
3 ! PR fortran/67721
4 ! Check that scalar to array assignments of derived type constructor
5 ! deep copy the value when there are allocatable components.
6
7 program p
8 implicit none
9
10 type :: t1
11 integer :: c1
12 end type t1
13 type :: t2
14 type(t1), allocatable :: c2
15 end type t2
16
17 block
18 type(t2) :: v(4)
19
20 v = t2(t1(3))
21 v(2)%c2%c1 = 7
22 v(3)%c2%c1 = 11
23 v(4)%c2%c1 = 13
24
25 if (v(1)%c2%c1 /= 3) STOP 1
26 if (v(2)%c2%c1 /= 7) STOP 2
27 if (v(3)%c2%c1 /= 11) STOP 3
28 if (v(4)%c2%c1 /= 13) STOP 4
29 end block
30 end program p