This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran, OOP] PR 78848: [7 Regression] ICE on writing CLASS variable with non-typebound DTIO procedure


Hi all,

the attached patch fixes an ICE on a valid DTIO example, which is in
fact a regression of one of my recent patches. See bugzilla for
details.

Regtests cleanly on x86_64-linux-gnu. Ok for trunk?

Cheers,
Janus


2016-12-18  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/78848
    * trans-io.c (get_dtio_proc): Generate non-typebound DTIO call for class
    variables, if no typebound DTIO procedure is available.

2016-12-18  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/78848
    * gfortran.dg/dtio_22.f90: New test.

Attachment: pr78848.diff
Description: Text document

! { dg-do run }
!
! PR 78848: [OOP] ICE on writing CLASS variable with non-typebound DTIO procedure
!
! Contributed by Mikael Morin <morin-mikael@orange.fr>

module m
  type :: t
    integer :: i = 123
  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
  character(3) :: buffer
  class(t), allocatable :: z
  allocate(z)
  write(buffer,"(DT)") z
  if (buffer /= "123") call abort()
end

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]