Debian Codegraph @

gcc/testsuite/gfortran.dg/alloc_comp_deep_copy_4.f03

raw
1 !{ dg-do run }
2 !
3 ! Contributed Vladimir Terzi <[email protected]>
4 ! Check that deep-copy for b=a works.
5
6 program pr114672
7 type node
8 integer::val
9 type(node),allocatable::next
10 end type
11
12 type(node)::a,b
13
14 allocate(a%next)
15 a%val=1
16 a%next%val=2
17 ! print*,a%val,a%next%val
18 b=a
19 b%val=3
20 b%next%val=4
21 if (loc(b) == loc(a)) stop 1
22 if (loc(b%next) == loc(a%next)) stop 2
23 ! print*,a%val,a%next%val
24 deallocate(b%next)
25 if (.NOT. allocated(a%next)) stop 3
26 ! print*,a%val,a%next%val
27 deallocate(a%next)
28 end
29