This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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 10:44:26AM -0400, Jakub Jelinek wrote:
> Please test the same when using ENTRY without RESULT.

Ok. I tried, and it didn't work:

        kl-nrb:~$ cat test_entry_1.f90 
        module iso
            implicit none
        contains

            function s_to_c(chars)
                character, pointer :: chars(:)
                character(len=len(chars)) :: s_to_c, s_to_c_2
                s_to_c = 'a'
                return
            entry s_to_c_2(chars)
                s_to_c_2 = 'b'
                return
            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)
            print *, s
            s = s_to_c_2(c)
            print *, s

        end program huj
        kl-nrb:~$ gfortran test_entry_1.f90 
         In file test_entry_1.f90:10

            entry s_to_c_2(chars)
                         1
         Internal Error at (1):
         insert_bbt(): Duplicate key found!

On the other hand, this slightly simplier testcase, with
functions of simplier type than CHARACTER(len=len(chars)) also
fails with the same error:

        kl-nrb:~$ cat test_entry_2.f90 
        module iso
            implicit none
        contains

            function s_to_c()
                integer :: s_to_c, s_to_c_2
                s_to_c = 1
                return
            entry s_to_c_2()
                s_to_c_2 = 2
                return
            end function s_to_c

        end module iso

        program huj
            use iso
            integer :: s

            s = s_to_c()
            print *, s
            s = s_to_c_2()
            print *, s

        end program huj
        kl-nrb:~$ gfortran test_entry_2.f90 
         In file test_entry_2.f90:9

            entry s_to_c_2()
                         1
         Internal Error at (1):
         insert_bbt(): Duplicate key found!

(I get the same result both with and without my patch.)

Am I doing something wrong, or are ENTRY in functions (of any
type) broken in gfortran? (Since this is the first time in my
life I use ENTRY, it's not unlikely that I'm doing something
wrong.  Both testcases compile and run without trouble in Absoft
and Intel compilers, but that does, after all, not prove
anything)


        Erik


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