aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/char_result_10.f90
blob: d14fd38151a703cadc00123c230fc7c7823ef9b6 (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
31
32
33
34
35
36
! { dg-do compile }
! PR 18883: Fake result variables of non-constant length, with ENTRY
function s_to_c(chars)
    character, pointer :: chars(:)
    character(len=len(chars)) :: s_to_c, s_to_c_2
    s_to_c = 'a'
    return
entry s_to_c_2(chars)
    s_to_c_2 = 'b'
    return
end function s_to_c

program huj

    implicit none
    interface
        function s_to_c(chars)
            character, pointer :: chars(:)
            character(len=len(chars)) :: s_to_c
        end function s_to_c

        function s_to_c_2(chars)
            character, pointer :: chars(:)
            character(len=len(chars)) :: s_to_c_2
        end function s_to_c_2
    end interface

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

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

end program huj