Debian Codegraph @

gcc/testsuite/gfortran.dg/deferred_character_4.f90

raw
1 ! { dg-do run }
2 !
3 ! Check that PR50221 comment #4 is fixed.
4 !
5 ! Contributed by Arjen Makus <[email protected]>
6 !
7 program chk_alloc_string
8 implicit none
9
10 character(len=:), dimension(:), allocatable :: strings
11 character(20) :: buffer
12 integer :: i
13
14 allocate( character(10):: strings(1:3) )
15
16 strings = [ "A ", "C ", "ABCD", "V " ]
17
18 if (len(strings) .ne. 4) STOP 1
19 if (size(strings, 1) .ne. 4) STOP 2
20 if (any (strings .ne. [character(len=4) :: "A", "C", "ABCD", "V"])) STOP 3
21
22 strings = [character(len=4) :: "A", "C", "ABCDE", "V", "zzzz"]
23
24 if (len(strings) .ne. 4) STOP 4
25 if (size(strings, 1) .ne. 5) STOP 5
26 if (any (strings .ne. [character(len=4) :: "A", "C", "ABCD", "V", "zzzz"])) STOP 6
27
28 write (buffer, "(5a4)") strings
29 if (buffer .ne. "A C ABCDV zzzz") STOP 7
30 end program chk_alloc_string