This is the mail archive of the gcc-bugs@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]

[Bug fortran/60255] Deferred character length variable at (1) cannot yet be associated with unlimited polymorphic entities


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60255

--- Comment #3 from janus at gcc dot gnu.org ---
Consider the following simple test case:


implicit none
call sub1("test")
call sub2()

contains

  subroutine sub1(dcl)   ! accepted
    character(len=*), target :: dcl
    class(*), pointer :: ucp

    ucp => dcl

    select type (ucp)
    type is (character(len=*))
      print *,"char"
    type is (real)
      print *,"real"
    class default
      print *,"something else"
    end select

  end subroutine


  subroutine sub2   ! rejected
    character(len=:), allocatable, target :: dcl
    class(*), pointer :: ucp

    dcl = "ttt"
    ucp => dcl

    select type (ucp)
    type is (character(len=*))
      print *,"char"
    type is (real)
      print *,"real"
    class default
      print *,"something else"
    end select

  end subroutine

end


While 'sub1' is currently accepted (with unpatched trunk) and shows the right
runtime behavior, 'sub2' is rejected with the error of comment 0.

With the patch in comment 2, both cases are accepted and show the right runtime
behavior.

The only potential problem I can see is that the '_size' component of the vtab
is zero and does not reflect its actual size.


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