c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / alloc_comp_deep_copy_3.f03
blob20a415e8e15560a71023ac93fa784de8a3484fda
1 ! { dg-do run }
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.
7 program p
8   implicit none
10   type :: t1
11     integer :: c1
12   end type t1
13   type :: t2
14     type(t1), allocatable :: c2
15   end type t2
17   block
18     type(t2) :: v(4)
20     v = t2(t1(3))
21     v(2)%c2%c1 =  7
22     v(3)%c2%c1 = 11
23     v(4)%c2%c1 = 13
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