3 ! Tests the fix for pr49954, in which concatenation to deferred length character
4 ! arrays, at best, did not work correctly.
9 character(len
=:), allocatable
:: a1(:)
10 character(len
=:), allocatable
:: a2(:), a3(:)
11 character(len
=:), allocatable
:: b1
12 character(len
=:), allocatable
:: b2
13 character(8) :: chr
= "IJKLMNOP"
14 character(48) :: buffer
16 a1
= ["ABCDEFGH","abcdefgh"]
17 a2
= "_"//a1
//chr
//"_"
18 if (any (a2
.ne
. ["_ABCDEFGHIJKLMNOP_","_abcdefghIJKLMNOP_"])) call abort
20 ! Check that the descriptor dtype is OK - the array write needs it.
21 write (buffer
, "(2a18)") a2
22 if (trim (buffer
) .ne
. "_ABCDEFGHIJKLMNOP__abcdefghIJKLMNOP_") call abort
24 ! Make sure scalars survived the fix!
26 b2
= "_"//b1
//chr
//"_"
27 if (b2
.ne
. "_ABCDEFGHIJKLMNOP_") call abort
29 ! Check the dependency is detected and dealt with by generation of a temporary.
31 if (any (a1
.ne
. ["?ABCDEFGH?","?abcdefgh?"])) call abort
32 ! With an array reference...
33 a1
= "?"//a1(1:2)//"?"
34 if (any (a1
.ne
. ["??ABCDEFGH??","??abcdefgh??"])) call abort
35 !... together with a substring.
36 a1
= "?"//a1(1:1)(2:4)//"?"
37 if (any (a1
.ne
. ["??AB?"])) call abort