https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67740
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
--- Comment #6 from anlauf at gcc dot gnu.org ---
Extending the testcase in comment#4:
program test2
implicit none
character(len=10), allocatable, target :: s(:)
character(len=:), pointer :: sptr(:)
type :: pointer_typec0_t
character(len=:), pointer :: data1(:)
end type pointer_typec0_t
type(pointer_typec0_t) :: co
!
allocate(s(3))
s(1) = '1234567890'
s(2) = 'qwertyuio '
s(3) = 'asdfghjk '
!
sptr => s
print *, sptr ! OK
co%data1 => s
print *, co%data1 ! not OK
!
print *,len(co%data1(1)),len_trim(co%data1(1)),co%data1(1)
print *,len(co%data1(2)),len_trim(co%data1(2)),co%data1(2)
print *,len(co%data1(3)),len_trim(co%data1(3)),co%data1(3)
end program test2
The tree-dump has:
.sptr = 10;
sptr = s;
sptr.span = s.span;
but
co.data1 = s;
co.data1.span = s.span;
so we don't set the character length in the association.