https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103312
Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org --- Comment #6 from Paul Thomas <pault at gcc dot gnu.org> --- Created attachment 57969 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57969&action=edit Partial fix for the PR The supplied testcase generates completely blank derived type symbols for the _vptr component of 'this' in 'func'. The chunk in resolve.cc fixes that. The rest of the patch allows the full testcase below to blast through to translation, where it dies in trans-decl.cc - again with blanks symbols in the default initializer this time. Of the compilers to which I have access, only NAG succeeds with the full testcase. If this%size() is replaced with a constant expression or an integer dummy argument, all compilers succeed, including current versions of gfortran. I have taken it but need to get on with daytime work for a few days. Paul module example type, abstract :: foo integer :: i contains procedure(foo_size), deferred :: size procedure(foo_func), deferred :: func end type interface function foo_func (this) result (string) import :: foo class(foo) :: this character(this%size()) :: string end function pure integer function foo_size (this) import foo class(foo), intent(in) :: this end function end interface end module module extension use example implicit none type, extends(foo) :: bar ! integer :: i contains procedure :: size procedure :: func end type contains pure integer function size (this) class(bar), intent(in) :: this size = this%i end function function func (this) result (string) class(bar) :: this character(this%size()) :: string string = repeat ("x", len (string)) end function end module use example use extension type(bar) :: a a%i = 5 print *, a%func() end