To: J3 07-302r1 From: Bill Long (Original from Jim Xia) Subject: Interpretation: SIZE= specifier and UDDTIO Date: 2007 November 15 NUMBER: F03/0105 TITLE: SIZE= specifier and UDDTIO KEYWORDS: SIZE=, UDDTIO DEFECT TYPE: Error STATUS: Erratum DISCUSSION 9.5.1.14 [191:21-26] says that when SIZE= specifier is used in a formatted input statement with explicit format specifications, the variable specified in the SIZE= specifier is determined by the data edit descriptors during the input statement. These rules, however, did not take into account the following situation where a parent READ statement with a DT edit descriptor invokes a user-defined DTIO formatted read subroutine that reads input data using list-directed or namelist READ statement. Consider the following example: module example type A integer x(10) contains procedure :: readArray generic :: read(formatted) => readArray end type contains subroutine readArray (dtv, unit, iotype, v_list, iostat, iomsg) class(A), 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, fmt=*, iostat=iostat, iomsg=iomsg) dtv%x end subroutine end module program test use example type(A) :: v integer countChar open (1, file='example.input', form='formatted') read (1, fmt='(DT)', advance='no', size=countChar) v end program test Note that there is no data edit descriptor in the UDDTIO subroutine, readArray, to count the total number of characters transferred during the child read. QUESTION: Is this example intended to be standard conforming? ANSWER: No, this example is not standard conforming. SIZE= specifier is not allowed in the example presented here. Edits are provided to correct this oversight. EDITS: [188:8+] In 9.5.1 "Control information list", after the list of constraints, append to the end of the first paragraph "A SIZE= specifier shall not appear in a parent input statement if the user-defined derived-type input procedure to be invoked performs either list-directed or namelist input on the same unit." SUBMITTED BY: Jim Xia HISTORY: m182 Submitted