summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/deferred_character_14.f90
blob: c6b7b25ee2fdf6fe44ed23b78b43e0959897dcf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
! { dg-do run }
!
! Test fix for PR60795 comments #1 and  #4
!
! Contributed by Kergonath  <kergonath@me.com>
!
module m
contains
    subroutine allocate_array(s_array)
        character(:), dimension(:), allocatable, intent(out) :: s_array

        allocate(character(2) :: s_array(2))
        s_array = ["ab","cd"]
    end subroutine
end module

program stringtest
    use m
    character(:), dimension(:), allocatable :: s4
    character(:), dimension(:), allocatable :: s
! Comment #1
    allocate(character(1) :: s(10))
    if (size (s) .ne. 10) STOP 1
    if (len (s) .ne. 1) STOP 2
! Comment #4
    call allocate_array(s4)
    if (size (s4) .ne. 2) STOP 3
    if (len (s4) .ne. 2) STOP 4
    if (any (s4 .ne. ["ab", "cd"])) STOP 5
 end program