Plugins: Add label-text.h to CPPLIB_H so it will be installed [PR115288]
[official-gcc.git] / gcc / testsuite / gfortran.dg / allocatable_function_7.f90
blob6629cd4b3665a1e8781d438b0ae9396d291bb592
1 ! { dg-do run }
3 ! PR fortran/56138
5 ! Contributed by Dominique d'Humieres and John Chludzinski,
6 ! using the code of John Reid
8 implicit none
9 interface
10 PURE FUNCTION s_to_c(string)
11 CHARACTER(LEN=*),INTENT(IN) :: string
12 CHARACTER(LEN=:),ALLOCATABLE :: s_to_c
13 ENDFUNCTION s_to_c
14 end interface
15 CHARACTER(LEN=:),ALLOCATABLE :: str
16 if (s_to_c("ABCdef") /= "ABCdef" .or. len(s_to_c("ABCdef")) /= 6) STOP 1
17 str = s_to_c("ABCdef")
18 if (str /= "ABCdef" .or. len(str) /= 6) STOP 2
19 str(1:3) = s_to_c("123")
20 if (str /= "123def" .or. len(str) /= 6) STOP 3
22 end
24 PURE FUNCTION s_to_c(string)
25 CHARACTER(LEN=*),INTENT(IN) :: string
26 CHARACTER(LEN=:),ALLOCATABLE :: s_to_c
27 s_to_c = string
28 END FUNCTION s_to_c