PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / deferred_character_7.f90
blobaa7a6621bef4fc48c14aadb88c8208198f63b5d4
1 ! { dg-do run }
3 ! Tests the fix for pr49954, in which concatenation to deferred length character
4 ! arrays, at best, did not work correctly.
8 implicit 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
16 a1 = ["ABCDEFGH","abcdefgh"]
17 a2 = "_"//a1//chr//"_"
18 if (any (a2 .ne. ["_ABCDEFGHIJKLMNOP_","_abcdefghIJKLMNOP_"])) STOP 1
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_") STOP 2
24 ! Make sure scalars survived the fix!
25 b1 = "ABCDEFGH"
26 b2 = "_"//b1//chr//"_"
27 if (b2 .ne. "_ABCDEFGHIJKLMNOP_") STOP 3
29 ! Check the dependency is detected and dealt with by generation of a temporary.
30 a1 = "?"//a1//"?"
31 if (any (a1 .ne. ["?ABCDEFGH?","?abcdefgh?"])) STOP 4
32 ! With an array reference...
33 a1 = "?"//a1(1:2)//"?"
34 if (any (a1 .ne. ["??ABCDEFGH??","??abcdefgh??"])) STOP 5
35 !... together with a substring.
36 a1 = "?"//a1(1:1)(2:4)//"?"
37 if (any (a1 .ne. ["??AB?"])) STOP 6
38 contains
39 end