<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic The accessibility is in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047424#M114449</link>
    <description>&lt;P&gt;The accessibility is irrelevant in the case where the list item is processed by a DTIO procedure. I am not aware of any outstanding issues with DTIO in 15.0.&lt;/P&gt;

&lt;P&gt;However, that there are only four of the five array elements is not right and I will look into that.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Mar 2015 21:22:35 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2015-03-12T21:22:35Z</dc:date>
    <item>
      <title>Derived type IO with private DT array component</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047418#M114443</link>
      <description>&lt;P&gt;I've run into a possible bug with derived type IO when I have a derived type with a private component array of derived types. I've included a example code snippet below that should reproduce the problem (I'm using ifort version 14.0.2.114). To summarize the problem, when I try to write my derived type using a formatted write statement it output the public component of the derived type, as expected, and then it outputs the first n-1 values of the component derived type, which is both private and not called in the main formatted write statement.&lt;/P&gt;

&lt;P&gt;In the sample code below the write statement should output:&lt;/P&gt;

&lt;PRE class="brush:;"&gt;    1.0000&lt;/PRE&gt;

&lt;P&gt;but instead outputs&lt;/P&gt;

&lt;PRE class="brush:;"&gt;    1.0000
    2.0000
    2.0000
    2.0000
    2.0000&lt;/PRE&gt;

&lt;P&gt;Sample code:&lt;/P&gt;

&lt;PRE class="brush:fortran;" style="font-size: 13.0080003738403px; line-height: 19.5120010375977px;"&gt;module DTIO
  implicit none

  ! derived types:
  type T1
    private
    real :: x
  contains
    procedure, private :: T1_write_formatted
    generic :: write(formatted) =&amp;gt; T1_write_formatted
  end type T1

  type T2
    private
    real :: x
    type(T1) :: y(5)
  contains
    procedure, private :: T2_write_formatted
    generic :: write(formatted) =&amp;gt; T2_write_formatted
  end type T2

  ! interfaces:
  interface T1
    module procedure :: T1_constructor
  end interface T1

  interface T2
    module procedure :: T2_constructor
  end interface T2
contains


  pure function T1_constructor( x ) result( val )
    real, intent(in) :: x
    type(T1) :: val
    val%x = x
  end function T1_constructor

  pure function T2_constructor( x ) result( val )
    real, intent(in) :: x
    type(T2) :: val
    val%x = x
    val%y = T1(2.0*x)
  end function T2_constructor

  subroutine T1_write_formatted( self, unit, iotype, v_list, iostat, iomsg )
    class(T1), intent(in)    :: self
    integer     , intent(in)    :: unit
    character(*), intent(in)    :: iotype
    integer     , intent(in)    :: v_list(:)
    integer     , intent(out)   :: iostat
    character(*), intent(inout) :: iomsg
    ! local variables:
    character(:), allocatable :: fmt

    ! determine format
    if (len_trim(iotype) &amp;gt; 0) then
      if (iotype(1:2) == 'DT') then
        if (len_trim(iotype) &amp;gt; 2) then
          fmt = '('//iotype(3:)//')'
          write(unit, fmt=fmt, iostat=iostat, iomsg=iomsg) self%x
          deallocate(fmt)
        else
          write(unit, *, iostat=iostat, iomsg=iomsg) self%x
        end if
      else if (iotype == 'LISTDIRECTED') then
        write(unit, *, iostat=iostat, iomsg=iomsg) self%x
      else if (iotype == 'NAMELIST') then
        write(unit, *, iostat=iostat, iomsg=iomsg) self%x
      end if
    end if
  end subroutine T1_write_formatted

  subroutine T2_write_formatted( self, unit, iotype, v_list, iostat, iomsg )
    class(T2), intent(in)    :: self
    integer     , intent(in)    :: unit
    character(*), intent(in)    :: iotype
    integer     , intent(in)    :: v_list(:)
    integer     , intent(out)   :: iostat
    character(*), intent(inout) :: iomsg
    ! local variables:
    character(:), allocatable :: fmt

    ! determine format
    if (len_trim(iotype) &amp;gt; 0) then
      if (iotype(1:2) == 'DT') then
        if (len_trim(iotype) &amp;gt; 2) then
          fmt = '('//iotype(3:)//')'
          write(unit, fmt=fmt, iostat=iostat, iomsg=iomsg) self%x
          deallocate(fmt)
        else
          write(unit, *, iostat=iostat, iomsg=iomsg) self%x
        end if
      else if (iotype == 'LISTDIRECTED') then
        write(unit, *, iostat=iostat, iomsg=iomsg) self%x
      else if (iotype == 'NAMELIST') then
        write(unit, *, iostat=iostat, iomsg=iomsg) self%x
      end if
    end if
  end subroutine T2_write_formatted
end module DTIO

program main
  use DTIO
  implicit none
  ! local parameters:
  type(T2) :: var

  var = T2(1.0)
  write(*,'(A)') 'formatting: unspecified'
  write(*,*) var
  write(*,'(A)') ''
  write(*,'(A)') 'formatting: specified'
  write(*,'(DT"F10.4")') var
end program main
&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Mar 2015 04:29:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047418#M114443</guid>
      <dc:creator>Thomas_D_1</dc:creator>
      <dc:date>2015-03-12T04:29:25Z</dc:date>
    </item>
    <item>
      <title>This source has several</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047419#M114444</link>
      <description>&lt;P&gt;This source has several syntactic errors. Please clear these up and post the corrected version.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2015 14:47:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047419#M114444</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2015-03-12T14:47:28Z</dc:date>
    </item>
    <item>
      <title>Fixed source code</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047420#M114445</link>
      <description>&lt;P&gt;Fixed source code&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2015 16:02:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047420#M114445</guid>
      <dc:creator>Thomas_D_1</dc:creator>
      <dc:date>2015-03-12T16:02:36Z</dc:date>
    </item>
    <item>
      <title>I think the behavior is</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047421#M114446</link>
      <description>&lt;P&gt;I think the behavior is correct. Since defined I/O procedures process the derived type and those procedures are in the module defining the type, all components are accessible.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2015 19:56:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047421#M114446</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2015-03-12T19:56:03Z</dc:date>
    </item>
    <item>
      <title>Isn't the problem here is</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047422#M114447</link>
      <description>&lt;P&gt;Isn't the problem here is that these private components (even though accessible) should actually &lt;EM&gt;not&lt;/EM&gt; be printed, according to the I/O procedures in Thomas' example?&lt;/P&gt;

&lt;P&gt;And, strangely, they are &lt;EM&gt;not&lt;/EM&gt; accessible for the DTIO in ifort 15.0.1, which refuses to compile the reduced version of Thomas' example code (error #5521: A derived-type object in an input/output list cannot have private components unless a suitable user-defined input/output procedure is available.)&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module DTIO
  implicit none

  type T1
    logical, private :: private_component
  end type

  type T2
    type(T1) :: has_private_component
  end type

  interface write(formatted)
    module procedure T2_write_formatted
  end interface

contains

   subroutine T2_write_formatted( self, unit, iotype, v_list, iostat, iomsg )
    class(T2), intent(in) :: self
    integer, intent(in) :: unit
    character(*), intent(in) :: iotype
	integer, dimension(:), intent(in) :: v_list
    integer, intent(out) :: iostat
    character(*), intent(inout) :: iomsg

  end subroutine

end module DTIO

program main
  use DTIO
  implicit none

  type(T2) :: var
  write (*, '(DT)') var

end program main&lt;/PRE&gt;

&lt;P&gt;Generally, I have the feeling that DTIO (esp. formatted) is not fully supported yet on ifort 15.0.1. Is this true? Is there significant improvement with ifort 15.0.2?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2015 20:47:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047422#M114447</guid>
      <dc:creator>Ferdinand_T_</dc:creator>
      <dc:date>2015-03-12T20:47:02Z</dc:date>
    </item>
    <item>
      <title>s_ftschi wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047423#M114448</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Ferdinand T. wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Isn't the problem here is that these private components (even though accessible) should actually &lt;EM&gt;not&lt;/EM&gt; be printed, according to the I/O procedures in Thomas' example?&lt;/P&gt;

&lt;P&gt;And, strangely, they are &lt;EM&gt;not&lt;/EM&gt; accessible for the DTIO in ifort 15.0.1, which refuses to compile the reduced version of Thomas' example code (error #5521: A derived-type object in an input/output list cannot have private components unless a suitable user-defined input/output procedure is available.)&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;What is especially strange to me is that it only prints four of the five T1 components. If the behavior was intended, i.e., printing the component derived types even though they are private, then why not print all five elements of the array?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2015 21:10:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047423#M114448</guid>
      <dc:creator>Thomas_D_1</dc:creator>
      <dc:date>2015-03-12T21:10:00Z</dc:date>
    </item>
    <item>
      <title>The accessibility is</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047424#M114449</link>
      <description>&lt;P&gt;The accessibility is irrelevant in the case where the list item is processed by a DTIO procedure. I am not aware of any outstanding issues with DTIO in 15.0.&lt;/P&gt;

&lt;P&gt;However, that there are only four of the five array elements is not right and I will look into that.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2015 21:22:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047424#M114449</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2015-03-12T21:22:35Z</dc:date>
    </item>
    <item>
      <title>mad\sblionel wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047425#M114450</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Steve Lionel wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;[...] The accessibility is irrelevant in the case where the list item is processed by a DTIO procedure. [...]&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;But why does the compiler trigger that error? (Code in my prior post - there is a DTIO procedure defined). I think that is incorrect.&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;EDIT: Is it intentional that the &lt;/EM&gt;user-id&lt;EM&gt; is displayed per &lt;/EM&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;user-id&lt;EM&gt; wrote:&lt;BR /&gt; ... &lt;BLOCKQUOTE&gt; instead of the user-name&lt;EM&gt; when quoting a post?&lt;/EM&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/EM&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 12 Mar 2015 21:41:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047425#M114450</guid>
      <dc:creator>Ferdinand_T_</dc:creator>
      <dc:date>2015-03-12T21:41:00Z</dc:date>
    </item>
    <item>
      <title>Ok. The error message is</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047426#M114451</link>
      <description>&lt;P&gt;Ok. The error message is incorrect. I have escalated that as issue&amp;nbsp;DPD200367665. Still working on the other one.&lt;/P&gt;

&lt;P&gt;And yeah, the quoting is not right - I will let the forum folks know.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2015 14:14:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047426#M114451</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2015-03-13T14:14:10Z</dc:date>
    </item>
    <item>
      <title>mad\sblionel wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047427#M114452</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Steve Lionel wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Ok. The error message is incorrect. I have escalated that as issue&amp;nbsp;DPD200367665. Still working on the other one.&lt;/P&gt;

&lt;P&gt;And yeah, the quoting is not right - I will let the forum folks know.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(83, 87, 94); font-family: Arial, 宋体, Tahoma, Helvetica, sans-serif; font-size: 13.0080003738403px; line-height: 19.5120010375977px; background-color: rgb(255, 255, 255);"&gt;Thanks for looking into this Steve. I looked through one of the working drafts for the Fortran 2008 standard (WD 1539-1) which specifies on page 237:&lt;/SPAN&gt;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P&gt;If a list item of derived type in a formatted input/output statement is not processed by a defined&amp;nbsp;input/output procedure, that list item is treated as if all of the components of the list item were&amp;nbsp;specified in the list in component order; those components shall be accessible in the scoping unit&amp;nbsp;containing the input/output statement and shall not be pointers or allocatable.&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Which seems to imply that this behavior of printing all components of a derived type when a user specified output procedure is present regardless of what that output procedure does is incorrect (&lt;SPAN style="line-height: 18.2000007629395px;"&gt;unfortunately I couldn't find anything more explicit on the topic)&lt;/SPAN&gt;. Also it's worth noting that if I change my type(T1) component array to an array of any intrinsic type (integer, real, ...) the output works as I would expect, i.e., it only outputs component x and not component y.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2015 14:52:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047427#M114452</guid>
      <dc:creator>Thomas_D_1</dc:creator>
      <dc:date>2015-03-13T14:52:00Z</dc:date>
    </item>
    <item>
      <title>The text relates to what</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047428#M114453</link>
      <description>&lt;P&gt;The text relates to what happens if the derived type is NOT processed by a user-defined I/O procedure, which is not the case here. If the type IS processed by a user procedure, then the normal rules of accessibility in that procedure apply.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2015 14:57:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047428#M114453</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2015-03-13T14:57:37Z</dc:date>
    </item>
    <item>
      <title>mad\sblionel wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047429#M114454</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Steve Lionel wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;The text relates to what happens if the derived type is NOT processed by a user-defined I/O procedure, which is not the case here. If the type IS processed by a user procedure, then the normal rules of accessibility in that procedure apply.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Right. It specifies the behavior we're seeing (minus printing only n-1 array components) explicitly for the case this isn't. Which would imply that for this case a different way of handling the output should be applied, unfortunately I couldn't find a spot where it explicitly says how this case should be handled in my brief search.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2015 15:03:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047429#M114454</guid>
      <dc:creator>Thomas_D_1</dc:creator>
      <dc:date>2015-03-13T15:03:00Z</dc:date>
    </item>
    <item>
      <title>Ok, I was mistaken in my</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047430#M114455</link>
      <description>&lt;P&gt;Ok, I was mistaken in my original claim that the first program executes correctly, and you are absolutely right that the output should be the same in both cases. I think I know what is happening - in the explicit format case, the compiler has to anticipate the possibility that var might not be handled by a DTIO routine, so it generates alternate code to list out all the components. This isn't working properly - it should give a run-time error in the case the DTIO wasn't used since there are private components, but it is somehow falling into the "list all components" case and not doing that right either. &amp;nbsp;Escalated as issue&amp;nbsp;DPD200367669.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2015 15:54:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047430#M114455</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2015-03-13T15:54:13Z</dc:date>
    </item>
    <item>
      <title>The bug that produced the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047431#M114456</link>
      <description>&lt;P&gt;The bug that produced the error message for the program in post #5 (DPD200367665) has been fixed - I expect the fix to appear in 16.0.1. The run-time issue (&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;DPD200367669) is still being worked on, but the basic problem is understood.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 21:26:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Derived-type-IO-with-private-DT-array-component/m-p/1047431#M114456</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2015-11-04T21:26:05Z</dc:date>
    </item>
  </channel>
</rss>

