https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106507
Bug ID: 106507 Summary: Invalid structure constructor for extending derive type Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: baradi09 at gmail dot com Target Milestone: --- The following snippet triggers a compilation error test.f90:17:25: 17 | inst = type2("test", 1) | 1 Error: Too many components in structure constructor at (1) when compiled with gfortran -c test.f90 although being standard compliant. The problem seems to be the deferred length character component. If the component is changed to fixed length (but still has the allocatable attribute), the compiler happily compiles it. --> test.f90 <-- module mod2 implicit none type :: type1 character(:), allocatable :: name end type type1 type, extends(type1) :: type2 integer :: data end type contains subroutine mysub() type(type2) :: inst inst = type2("test", 1) end subroutine mysub end module mod2