1! { dg-do run } 2! 3! Tests the fix for pr49954, in which concatenation to deferred length character 4! arrays, at best, did not work correctly. 5! 6! 7! 8implicit none 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 15 16 a1 = ["ABCDEFGH","abcdefgh"] 17 a2 = "_"//a1//chr//"_" 18 if (any (a2 .ne. ["_ABCDEFGHIJKLMNOP_","_abcdefghIJKLMNOP_"])) call abort 19 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 23 24! Make sure scalars survived the fix! 25 b1 = "ABCDEFGH" 26 b2 = "_"//b1//chr//"_" 27 if (b2 .ne. "_ABCDEFGHIJKLMNOP_") call abort 28 29! Check the dependency is detected and dealt with by generation of a temporary. 30 a1 = "?"//a1//"?" 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 38contains 39end 40