[patch,gfortran] PR 24503: Character functions of non-constant length
Jakub Jelinek
jakub@redhat.com
Tue Oct 25 14:58:00 GMT 2005
On Tue, Oct 25, 2005 at 05:37:56PM +0300, Erik Edelmann wrote:
> :ADDPATCH fortran:
>
> Here's a patch to fix PR 24503. The problem is that, for fake
> result character variables of non-connstant length,
> gfc_finish_var_decl will be called. This function, however, is
> apperantly not written with fake result variables in mind. Two
> changes were needed: Add the decl to the current function, rather
> than to the parent, and make an assertion accept fake result
> variables.
Please test the same when using ENTRY without RESULT.
> function s_to_c(chars)
> character, pointer :: chars(:)
> character(len=size(chars)) :: s_to_c
> character(len=size(chars)) :: s_to_c2
> integer :: i
> entry s_to_c2(chars)
>
> do i = 1, size(chars)
> s_to_c2(i:i) = chars(i)
> end do
> end function s_to_c
>
> end module iso
>
> program huj
>
> use iso
> character, pointer :: c(:)
> character(3) :: s
>
> allocate(c(5))
> c = (/"a", "b", "c" /)
> s = s_to_c(c)
>
> end program huj
Jakub
More information about the Fortran
mailing list