This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/60255] Deferred character length variable at (1) cannot yet be associated with unlimited polymorphic entities
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 18 Feb 2014 14:20:28 +0000
- Subject: [Bug fortran/60255] Deferred character length variable at (1) cannot yet be associated with unlimited polymorphic entities
- Auto-submitted: auto-generated
- References: <bug-60255-4 at http dot gcc dot gnu dot org/bugzilla/>
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.