3 ! Test the fix for PR88247 and more besides :-)
5 ! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
9 character(:), allocatable
:: c
10 character(:), dimension(:), allocatable
:: d
12 type(t
), allocatable
:: x
14 call foo ('abcdef','ghijkl')
15 associate (y
=> [x
%c(:)])
16 if (y(1) .ne
. 'abcdef') stop 1
19 call foo ('ghi','ghi')
20 associate (y
=> [x
%c(2:)])
21 if (y(1) .ne
. 'hi') stop 2
24 call foo ('lmnopq','ghijkl')
25 associate (y
=> [x
%c(:3)])
26 if (y(1) .ne
. 'lmn') stop 3
29 call foo ('abcdef','ghijkl')
30 associate (y
=> [x
%c(2:4)])
31 if (y(1) .ne
. 'bcd') stop 4
34 call foo ('lmnopqrst','ghijklmno')
35 associate (y
=> x
%d(:))
36 if (len(y
) .ne
. 9) stop 5
37 if (any (y
.ne
. ['lmnopqrst','ghijklmno'])) stop 5
40 if (x
%d(1) .ne
. 'zqrtyd') stop 5
42 call foo ('lmnopqrst','ghijklmno')
43 associate (y
=> x
%d(:)(2:4))
44 if (any (y
.ne
. ['mno','hij'])) stop 6
47 call foo ('abcdef','ghijkl')
48 associate (y
=> [x
%d(:)])
49 if (len(y
) .ne
. 6) stop 7
50 if (any (y
.ne
. ['abcdef','ghijkl'])) stop 7
53 call foo ('lmnopqrst','ghijklmno')
54 associate (y
=> [x
%d(2:1:-1)])
55 if (len(y
) .ne
. 9) stop 8
56 if (any (y
.ne
. ['ghijklmno','lmnopqrst'])) stop 8
61 subroutine foo (c1
, c2
)
62 character(*) :: c1
, c2
63 if (allocated (x
)) deallocate (x
)