Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Derived-type io

geard__simon
Beginner
426 Views

I'm trying to use derived-type io which is on the list of new features but can't get my code to compile. I've stared at the code for too long now so hopefully some fresh eyes will immediately spot my mistake(s).

Thanks.

[fortran]

module points
  implicit none

  type point
     real :: m_p(3)
   contains
     procedure, public :: write_f_point
     generic           :: write(formatted) => write_f_point
     procedure, public :: print => print_point
  end type point


contains

  subroutine print_point(this)
    class(point), intent(in) :: this
    write(*,'(dt)') this
  end subroutine print_point

  subroutine write_f_point(this, u, iotype, v_list, iostat, iomsg)
    class(point), intent(in)    :: this
    integer, intent(in)         :: u
    character(*), intent(in)    :: iotype
    integer, intent(in)         :: v_list(:)
    integer, intent(out)        :: iostat
    character(*), intent(inout) :: iomsg

    iostat = 0
    write(*,fmt='(3(a,f0.4),a)') '(',this%m_p(1),',',this%m_p(2),',',this%m_p(3),')'
  end subroutine write_f_point
end module points
[/fortran]

ifort -V -o points.o -c points.f90
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.0.051 Beta Build 20130529
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.

ifort: NOTE: The Beta evaluation period for this product ends on 27-sep-2013 UTC.
 Intel(R) Fortran 14.0-1530
points.f90(17): error #8309: A list item shall not be polymorphic unless it is processed by a user-defined derived-type input/output procedure.   [THIS]
    write(*,'(dt)') this
--------------------^
compilation aborted for points.f90 (code 1)

0 Kudos
2 Replies
Steven_L_Intel1
Employee
426 Views

Please use Intel Premier Support for all beta issues. But before you do that, try the beta update which is now available. We fixed many issues in DTIO. I think what you're doing should be ok.

0 Kudos
geard__simon
Beginner
426 Views

Thanks - I'll take it to Premier Support.

0 Kudos
Reply