https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86167
Bug ID: 86167 Summary: allocation variable length character array in derived type incorrect Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: simon.kluepfel at gmail dot com Target Milestone: --- Created attachment 44285 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44285&action=edit main.f03 Allocation of a member of the form type a character(len=:),dimension(:),allocatable :: a1 end type a is not handled correctly. ---8<--- program main implicit none type a character(len=:),dimension(:),allocatable :: a1 end type a character(len=:),dimension(:),allocatable :: a1,a2 type(a) :: ta type(a) :: tb allocate(character(len=2) :: a1(2)) allocate(a2,source=a1) allocate(character(len=2) :: ta%a1(2)) allocate(tb%a1,source=a2) write(*,*) size(a1),len(a1),len(a1(1)) write(*,*) size(a2),len(a2),len(a1(1)) write(*,*) size(ta%a1),len(ta%a1),len(ta%a1(1)) write(*,*) size(tb%a1),len(tb%a1),len(tb%a1(1)) end program main ---8<--- $ ./a.out 2 2 2 2 2 2 2 0 2 2 0 2 the last two lines should be all 2's gcc version 8.1.0 (Debian 8.1.0-5)