2017-11-09 Steven G. Kargl <kargl@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / deferred_character_14.f90
blob3c4163ee7ac4d3a05a8f8906785c63ded6a9216b
1 ! { dg-do run }
3 ! Test fix for PR60795 comments #1 and #4
5 ! Contributed by Kergonath <kergonath@me.com>
7 module m
8 contains
9 subroutine allocate_array(s_array)
10 character(:), dimension(:), allocatable, intent(out) :: s_array
12 allocate(character(2) :: s_array(2))
13 s_array = ["ab","cd"]
14 end subroutine
15 end module
17 program stringtest
18 use m
19 character(:), dimension(:), allocatable :: s4
20 character(:), dimension(:), allocatable :: s
21 ! Comment #1
22 allocate(character(1) :: s(10))
23 if (size (s) .ne. 10) call abort
24 if (len (s) .ne. 1) call abort
25 ! Comment #4
26 call allocate_array(s4)
27 if (size (s4) .ne. 2) call abort
28 if (len (s4) .ne. 2) call abort
29 if (any (s4 .ne. ["ab", "cd"])) call abort
30 end program