summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/char_result_9.f90
blob: 062901e1bed43fe4ff2d1bc1d8a44fcb96ad5d7d (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
! { dg-do compile }
! PR 18883: Fake result variables of non-constant length, in module
module foo
contains
    function s_to_c(chars)
        character, pointer :: chars(:)
        character(len=len(chars)) :: s_to_c
        s_to_c = 'a'
    end function s_to_c
end module foo

program huj

    use foo

    implicit none
    character, pointer :: c(:)
    character(3) :: s

    allocate(c(5))
    c = (/"a", "b", "c" /)
    s = s_to_c(c)

end program huj

! { dg-final { cleanup-modules "foo" } }