[Bug fortran/78659] [F03] Spurious "requires DTIO" reported against namelist statement

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Dec 18 21:23:00 GMT 2016


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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid

--- Comment #9 from janus at gcc dot gnu.org ---
Btw, here is another case similar to the original problem in comment 0 (from PR
78661 comment 5):


MODULE m
  IMPLICIT NONE
  TYPE :: t
    CHARACTER :: c
  CONTAINS
    PROCEDURE :: write_formatted
    GENERIC :: WRITE(FORMATTED) => write_formatted
  END TYPE
CONTAINS
  SUBROUTINE write_formatted(dtv, unit, iotype, v_list, iostat, iomsg)
    CLASS(t), INTENT(IN) :: dtv
    INTEGER, INTENT(IN) :: unit
    CHARACTER(*), INTENT(IN) :: iotype
    INTEGER, INTENT(IN) :: v_list(:)
    INTEGER, INTENT(OUT) :: iostat
    CHARACTER(*), INTENT(INOUT) :: iomsg
    WRITE (unit, "(A)", IOSTAT=iostat, IOMSG=iomsg) dtv%c
  END SUBROUTINE
END MODULE

PROGRAM p
  USE m
  IMPLICIT NONE
  Class(t), allocatable :: x
  NAMELIST /nml/ x
  x = t('a')
  WRITE (*, nml)
END


Although it is supposed to be valid, this is still rejected with 

   NAMELIST /nml/ x
               1
Error: NAMELIST object ‘x’ in namelist ‘nml’ at (1) is polymorphic and requires
a defined input/output procedure


More information about the Gcc-bugs mailing list