[Bug fortran/78661] New: Namelist output missing object designator under DTIO
ian_harvey at bigpond dot com
gcc-bugzilla@gcc.gnu.org
Sat Dec 3 10:15:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78661
Bug ID: 78661
Summary: Namelist output missing object designator under DTIO
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: ian_harvey at bigpond dot com
Target Milestone: ---
The following, when compiled with recent trunk (r243219), generates output that
is missing the "name =" part of the name-value subsequence for the object x.
MODULE m
IMPLICIT NONE
TYPE :: t
CHARACTER :: c
CONTAINS
PROCEDURE :: write_formatted
GENERIC :: WRITE(FORMATTED) => write_formatted
! Work around for PR78659.
PROCEDURE :: read_formatted
GENERIC :: READ(FORMATTED) => read_formatted
END TYPE t
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 write_formatted
! Workaround for PR78659.
SUBROUTINE read_formatted(dtv, unit, iotype, v_list, iostat, iomsg)
CLASS(t), INTENT(INOUT) :: dtv
INTEGER, INTENT(IN) :: unit
CHARACTER(*), INTENT(IN) :: iotype
INTEGER, INTENT(IN) :: v_list(:)
INTEGER, INTENT(OUT) :: iostat
CHARACTER(*), INTENT(INOUT) :: iomsg
READ (unit, "(A)", IOSTAT=iostat, IOMSG=iomsg) dtv%c
END SUBROUTINE read_formatted
END MODULE m
PROGRAM p
USE m
IMPLICIT NONE
TYPE(t) :: x
NAMELIST /nml/ x
x = t('a')
WRITE (*, nml)
END PROGRAM p
$ gfortran 2016-12-03\ namelist2.f90 && ./a.out
&NML
a
/
The correct output should be something like:
&NML
x = a
/
UDDTIO procedures are responsible for writing/reading the value part of the
name-value subsequence, the processor still has responsibility for the name=
part.
More information about the Gcc-bugs
mailing list