https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78881
--- Comment #1 from janus at gcc dot gnu.org --- It seems that this problem not only appears when reading from internal units, but also from std input: module t_m implicit none type, public :: t character(len=:), allocatable :: m_s contains procedure, pass(this) :: read_t generic :: read(formatted) => read_t end type contains subroutine read_t(this, lun, iotype, vlist, istat, imsg) ! argument definitions class(t), intent(inout) :: this integer, intent(in) :: lun character(len=*), intent(in) :: iotype integer, intent(in) :: vlist(:) integer, intent(out) :: istat character(len=*), intent(inout) :: imsg ! local variables character :: c integer :: i do i=1,5 read( unit=lun, fmt="(a1)", iostat=istat, iomsg=imsg ) c select case ( istat ) case ( 0 ) write( *, *) "i = ", i, ", c = ", c case default write( *, *) "i = ", i, ", istat = ", istat, imsg return end select end do end subroutine end module program p use t_m implicit none ! character(len=5) :: s = "Hello" type(t) :: foo read( unit=*, fmt=*) foo end