This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch,gfortran] PR 24503: Character functions of non-constant length


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]