2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / alloc_comp_assign_9.f90
blob9051bafa0198eee755880f29298d7209e5b1b718
1 ! { dg-do run }
2 ! Test the fix for PR39519, where the presence of the pointer
3 ! as the first component was preventing the second from passing
4 ! the "alloc_comp" attribute to the derived type.
6 ! Contributed by Gilbert Scott <gilbert.scott@easynet.co.uk>
8 PROGRAM X
9 TYPE T
10 INTEGER, POINTER :: P
11 INTEGER, ALLOCATABLE :: A(:)
12 END TYPE T
13 TYPE(T) :: T1,T2
14 ALLOCATE ( T1%A(1) )
15 ALLOCATE ( T2%A(1) )
16 T1%A = 23
17 T2 = T1
18 T1%A = 42
19 if (T2%A(1) .NE. 23) CALL ABORT
20 END PROGRAM X