<?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 SIZE attribute in READ statement when EOF is reached in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748251#M5523</link>
    <description>buffer(:n_chars_read) determines the entity that receives the data, which occurs in item 6 of 9.5.3:&lt;BR /&gt;(6) Transfer data between the file and the entities specified by the input/output list (if any) or&lt;BR /&gt;namelist.&lt;BR /&gt;&lt;BR /&gt;Later, item 9 in 9.5.3 says:&lt;BR /&gt;(9) Cause any variable specified in a SIZE= specifier to become defined.&lt;BR /&gt;&lt;BR /&gt;Thus, it has to be defined. I would assume that if and EOF occured, then nothing was read and the variable specified in a SIZE= should be set to zero.&lt;BR /&gt;&lt;BR /&gt;The variable n_chars_read is assigned by the READ statement after buffer(:n_chars_read) is processed.&lt;BR /&gt;The code might be confusing because n_chars_read shows up twice, but it could be a different variable.&lt;BR /&gt;</description>
    <pubDate>Fri, 30 Jul 2010 04:18:18 GMT</pubDate>
    <dc:creator>leandrog</dc:creator>
    <dc:date>2010-07-30T04:18:18Z</dc:date>
    <item>
      <title>SIZE attribute in READ statement when EOF is reached</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748249#M5521</link>
      <description>The SUBROUTINE get_unit of the popular iso_varying_string.f95 module, uses the following line:&lt;BR /&gt;&lt;BR /&gt;read(unit=unit, FMT="(A)", ADVANCE="NO", &amp;amp;&lt;BR /&gt; IOSTAT=iostat, SIZE=n_chars_read) buffer(:n_chars_read)&lt;BR /&gt;&lt;BR /&gt;If an EOF is reached, apparently n_chars_read is not specified, and the subroutine produces unexpected results.&lt;BR /&gt;Apparently, gfortran assigns n_chars_read=0, so the subroutine works.&lt;BR /&gt;&lt;BR /&gt;I'm not sure what the standard says about this, but it's something that ifort programmers should be aware of.&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Jul 2010 19:58:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748249#M5521</guid>
      <dc:creator>leandrog</dc:creator>
      <dc:date>2010-07-29T19:58:51Z</dc:date>
    </item>
    <item>
      <title>SIZE attribute in READ statement when EOF is reached</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748250#M5522</link>
      <description>The code you show seems to assume that the SIZE= value is set before the length of the data transfer is established. The standard says this is not the case. According to 9.5.3 (Execution of a data transfer input/output statement), definition of the SIZE= variable is the very last thing to happen before the END=, ERR=, EOR= or IOSTAT is processed.&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Jul 2010 20:49:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748250#M5522</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-07-29T20:49:57Z</dc:date>
    </item>
    <item>
      <title>SIZE attribute in READ statement when EOF is reached</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748251#M5523</link>
      <description>buffer(:n_chars_read) determines the entity that receives the data, which occurs in item 6 of 9.5.3:&lt;BR /&gt;(6) Transfer data between the file and the entities specified by the input/output list (if any) or&lt;BR /&gt;namelist.&lt;BR /&gt;&lt;BR /&gt;Later, item 9 in 9.5.3 says:&lt;BR /&gt;(9) Cause any variable specified in a SIZE= specifier to become defined.&lt;BR /&gt;&lt;BR /&gt;Thus, it has to be defined. I would assume that if and EOF occured, then nothing was read and the variable specified in a SIZE= should be set to zero.&lt;BR /&gt;&lt;BR /&gt;The variable n_chars_read is assigned by the READ statement after buffer(:n_chars_read) is processed.&lt;BR /&gt;The code might be confusing because n_chars_read shows up twice, but it could be a different variable.&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Jul 2010 04:18:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748251#M5523</guid>
      <dc:creator>leandrog</dc:creator>
      <dc:date>2010-07-30T04:18:18Z</dc:date>
    </item>
    <item>
      <title>SIZE attribute in READ statement when EOF is reached</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748252#M5524</link>
      <description>I don't understand what you wrote in the last post. Perhaps you could show a small but complete program that demonstrates the issue?&lt;BR /&gt;&lt;BR /&gt;The single source line you posted implies to me that the author believes that the SIZE value is set before the I/O list is processed, but the standard has it the other way around. Perhaps you don't understand "standard speak". Here, "become defined" means "has a value stored into it".</description>
      <pubDate>Fri, 30 Jul 2010 14:34:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748252#M5524</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-07-30T14:34:10Z</dc:date>
    </item>
    <item>
      <title>SIZE attribute in READ statement when EOF is reached</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748253#M5525</link>
      <description>Let's make it simpler. My initial point was this:&lt;BR /&gt;&lt;BR /&gt;Compiling with ifort 11.1, the following line will not store a value into n_chars_read when an EOF occurs (i.e. iostat = -1):&lt;BR /&gt;&lt;BR /&gt;read(unit=unit, FMT="(A)", ADVANCE="NO", IOSTAT=iostat, SIZE=n_chars_read) buffer&lt;BR /&gt;&lt;BR /&gt;n_chars_read becomes defined on step 9 of 9.5.3 and this step should not be skipped even if an EOF occured, in which case the value 0 (zero) should be stored into n_chars_read.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Note that I removed (:n_chars_read) from buffer(:n_chars_read) because that was leading to a different discussion.&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Jul 2010 16:13:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748253#M5525</guid>
      <dc:creator>leandrog</dc:creator>
      <dc:date>2010-07-30T16:13:48Z</dc:date>
    </item>
    <item>
      <title>SIZE attribute in READ statement when EOF is reached</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748254#M5526</link>
      <description>Ok, I get it now. This appears to be a problem only if one is positioned at the end of file before doing the READ. If you simply read up to and past the end of the record, the SIZE value is ok. I'll report this to the developers. Issue ID is DPD200158604.&lt;BR /&gt;&lt;BR /&gt;I still think the code you posted originally is wrong.</description>
      <pubDate>Fri, 30 Jul 2010 17:20:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748254#M5526</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-07-30T17:20:25Z</dc:date>
    </item>
    <item>
      <title>SIZE attribute in READ statement when EOF is reached</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748255#M5527</link>
      <description>Right. OK. Thank you.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;What about this code:&lt;BR /&gt;&lt;BR /&gt;INTEGER, PARAMETER :: unit = 10&lt;BR /&gt;INTEGER :: dummy, n_chars_read, iostat&lt;BR /&gt;CHARACTER(LEN=256) :: buffer&lt;BR /&gt;n_chars_read = 5&lt;BR /&gt;dummy = n_chars_read&lt;BR /&gt;read(unit=unit, FMT="(A)", ADVANCE="NO", IOSTAT=iostat, SIZE=n_chars_read) buffer(1:dummy)&lt;BR /&gt;&lt;BR /&gt;From my point of view the original code and this one should do the same.</description>
      <pubDate>Fri, 30 Jul 2010 17:54:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748255#M5527</guid>
      <dc:creator>leandrog</dc:creator>
      <dc:date>2010-07-30T17:54:25Z</dc:date>
    </item>
    <item>
      <title>SIZE attribute in READ statement when EOF is reached</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748256#M5528</link>
      <description>Yes, that code and the original have the same meaning. But I don't think that's what the author of the first code intended.</description>
      <pubDate>Fri, 30 Jul 2010 18:01:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748256#M5528</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-07-30T18:01:38Z</dc:date>
    </item>
    <item>
      <title>SIZE attribute in READ statement when EOF is reached</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748257#M5529</link>
      <description>Hi Steve --&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;In fact, I *did* mean what I wrote in the first code. But it looks fishy, unless you see the context; n_chars_read is set by an earlier statement as the number of characters to read, and is then overwritten after the read statement has completed with the number of characters actually read.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;cheers,&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Rich&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 30 Jul 2010 18:21:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748257#M5529</guid>
      <dc:creator>townsendastro_wisc_e</dc:creator>
      <dc:date>2010-07-30T18:21:23Z</dc:date>
    </item>
    <item>
      <title>SIZE attribute in READ statement when EOF is reached</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748258#M5530</link>
      <description>As an addendum, it seems like this problem has come up before:&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=62433" target="_blank"&gt;http://software.intel.com/en-us/forums/showthread.php?t=62433&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Still no fix?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 30 Jul 2010 18:25:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748258#M5530</guid>
      <dc:creator>townsendastro_wisc_e</dc:creator>
      <dc:date>2010-07-30T18:25:50Z</dc:date>
    </item>
    <item>
      <title>SIZE attribute in READ statement when EOF is reached</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748259#M5531</link>
      <description>Looks like I missed recognizing that there was a bug from that earlier post. Sorry about that.&lt;BR /&gt;&lt;BR /&gt;And thanks for the clarification - as I noted above, it wasn't entirely clear from the single source line what was intended.</description>
      <pubDate>Fri, 30 Jul 2010 21:27:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748259#M5531</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-07-30T21:27:40Z</dc:date>
    </item>
    <item>
      <title>SIZE attribute in READ statement when EOF is reached</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748260#M5532</link>
      <description>Fixed in version 12.</description>
      <pubDate>Wed, 16 Feb 2011 20:35:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/SIZE-attribute-in-READ-statement-when-EOF-is-reached/m-p/748260#M5532</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-02-16T20:35:45Z</dc:date>
    </item>
  </channel>
</rss>

