https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78737
--- Comment #5 from janus at gcc dot gnu.org ---
(In reply to janus from comment #4)
> Looking at the dump, one probably needs a polymorphic reference to
> 'a->_vptr->write_formatted' instead of using the interface?
Btw, such wrong-code behavior is also seen in the non-abstract version:
module object_interface
type :: object
contains
procedure :: write_formatted
generic :: write(formatted) => write_formatted
end type
contains
subroutine write_formatted(this,unit,iotype,vlist,iostat,iomsg)
class(object), intent(in) :: this
integer, intent(in) :: unit
character (len=*), intent(in) :: iotype
integer, intent(in) :: vlist(:)
integer, intent(out) :: iostat
character (len=*), intent(inout) :: iomsg
end subroutine
subroutine assert(a)
class(object):: a
write(*,*) a
end subroutine
end module
end
If the write procedure is overwritten in an extended type, then the write
statement still calls the one from the base class, which is wrong.