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

            Bug ID: 81296
           Summary: derived type I/o problem
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ian at rhymneyconsulting dot co.uk
  Target Milestone: ---

Created attachment 41668
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41668&action=edit
source file showing error at run time

I believe the following program to be standard conforming.

module dtio_01_module

  type :: person

    character (len=40) :: name
    integer :: age

  contains

    procedure, private :: pwf
    generic :: write (formatted) => pwf

  end type person

contains

  subroutine pwf(dtv, unit, iotype, vlist, iostat, iomsg)

! argument definitions

    class (person), intent (in) :: dtv
    integer, intent (in) :: unit
    character (len=*), intent (in) :: iotype
    integer, intent (in) :: vlist(:)
    integer, intent (out) :: iostat
    character (len=*), intent (inout) :: iomsg

! local variable

    character (len= 9) :: pfmt

! vlist(1) and (2) are to be used as the field widths of the two
! components of the derived type variable. First set up the format to
! be used for output.

    write ( pfmt, '(a,i2,a,i1,a)' ) '(a', vlist(1), ',i', vlist(2), ')'
    print *,pfmt

! now the basic output statement

    write (unit, fmt=pfmt, iostat=iostat) dtv%name, dtv%age

  end subroutine pwf

end module dtio_01_module

program ch4001

  use dtio_01_module

  type (person) :: person_01=person('Ian Chivers',65)

  print *,person_01%name
  print *,person_01%age

  WRITE( 6, FMT="( DT (20,3) )" ) person_01

  write (6, 10) person_01
  10 format( DT(15,3) )

end program ch4001

I get the following error at run time.

c:\document\fortran\fourth_edition\examples>gfortran ch4001.f90

c:\document\fortran\fourth_edition\examples>a.exe
 Ian Chivers
          65
 (a20,i3) Ian Chivers          65
At line 58 of file ch4001.f90 (unit = 6, file = 'stdout')
Fortran runtime error: Missing DTIO procedure or intrinsic type passed for item
1 in formatted transfer
( DT(15,3) )
   ^

Error termination. Backtrace:

Could not print backtrace: libbacktrace could not find executable to open
#0  0xffffffff
#1  0xffffffff
#2  0xffffffff
#3  0xffffffff
#4  0xffffffff
#5  0xffffffff
#6  0xffffffff
#7  0xffffffff
#8  0xffffffff
#9  0xffffffff
#10  0xffffffff
#11  0xffffffff
#12  0xffffffff
#13  0xffffffff

Reply via email to