https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60593
--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- This PR is fixed by the patch at https://gcc.gnu.org/ml/fortran/2014-08/msg00114.html. Test that can be executed: character(len=10), target :: c character(len=:), pointer :: p c = 'abcdefghij' p => c(2:10) print *, C2FChar(5, p) contains function C2FChar(j, s) result(res) implicit none integer, intent(in) :: j character(len=:), pointer, intent(in) :: s character(len=:), allocatable :: res integer i allocate(character(j) :: res) forall (i = 1:j) res(i:i) = s(i:i) end function end [Book15] f90/bug% a.out bcdef