https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78848

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code

--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to Jerry DeLisle from comment #2)
> I think its invalid in that the type contains no object that could be
> written or even allocated.

I think empty types are valid in principle, but that's not the point. Here is a
slightly expanded test case (with a non-empty type) that should actually print
something. Still it ICEs:

module m
  type :: t
    integer :: i
  contains
    procedure :: wf
    generic :: write(formatted) => wf
  end type
  interface write(formatted)
    procedure wf
  end interface
contains
  subroutine wf(this, unit, b, c, iostat, iomsg)
    class(t), intent(in) :: this
    integer, intent(in) :: unit
    character, intent(in) :: b
    integer, intent(in) :: c(:)
    integer, intent(out) :: iostat
    character, intent(inout) :: iomsg
  WRITE (unit, "(i3)", IOSTAT=iostat, IOMSG=iomsg) this%i
  end subroutine
end

program p
  use m
  class(t), allocatable :: z
  allocate(z)
  print *, z
end

Reply via email to