1! { dg-do run } 2! 3! PR fortran/56138 4! 5! Contributed by John Chludzinski, using the code of John Reid 6! 7implicit none 8CHARACTER(LEN=:),ALLOCATABLE :: str 9if (s_to_c("ABCdef") /= "ABCdef" .or. len(s_to_c("ABCdef")) /= 6) STOP 1 10str = s_to_c("ABCdef") 11if (str /= "ABCdef" .or. len(str) /= 6) STOP 2 12str(1:3) = s_to_c("123") 13if (str /= "123def" .or. len(str) /= 6) STOP 3 14 15contains 16 17PURE FUNCTION s_to_c(string) 18 CHARACTER(LEN=*),INTENT(IN) :: string 19 CHARACTER(LEN=:),ALLOCATABLE :: s_to_c 20 s_to_c = string 21ENDFUNCTION s_to_c 22end 23