2 ! Test assignments of nested derived types with character allocatable
3 ! components(PR 20541). Subroutine test_ab6 checks out a bug in a test
4 ! version of gfortran's allocatable arrays.
6 ! Contributed by Erik Edelmann <eedelmann@gcc.gnu.org>
7 ! and Paul Thomas <pault@gcc.gnu.org>
10 character(4), allocatable
:: ch(:)
14 type (a
), allocatable
:: at(:)
20 character(4) :: chr1(4) = (/"abcd","efgh","ijkl","mnop"/)
21 character(4) :: chr2(4) = (/"qrst","uvwx","yz12","3456"/)
25 ! Check constructor with character array constructors.
26 x(2) = a((/"qrst","uvwx","yz12","3456"/))
28 y(1) = b((/x(1),x(2)/))
29 y(2) = b((/x(2),x(1)/))
33 if (any((/((y(2)%at(i
)%ch(j
),j
=1,4),i
=1,2)/) .ne
. &
34 (/chr1
, chr2
/))) call abort ()
40 subroutine test_ab6 ()
41 ! This subroutine tests the presence of a scalar derived type, intermediate
42 ! in a chain of derived types with allocatable components.
43 ! Contributed by Salvatore Filippone <salvatore.filippone@uniroma2.it>
50 type(b
), allocatable
:: b(:)
56 p
= c((/b(a((/"Mary","Lamb"/)))/))
59 if (any ((bv
%a
%ch(:)) .ne
. (/"Mary","Lamb"/))) call abort ()
61 end subroutine test_ab6