- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am having a problem with end of file when reading a stream access file. iostat does not indicate the end of file under some conditions. My compiler version is Intel Fortran 11.1 update 4 (I think), build 080, running onMac OS X 10.5.8.
Make a test file of length 8193 bytes. The contents are irrelevant for this demo. Here is my program and results:
mac56:~/fortran/stream 2> ls -Tgo dat5
-rw-r--r-- 1 8193 Apr 28 23:36:53 2010 dat5
mac56:~/fortran/stream 3> file dat5
dat5: ASCII text
mac56:~/fortran/stream 4> cat stream-demo-1.f90
program test
integer buf(4096) ! default 32-bit integers
integer ios
open (10, file='dat5', access='stream', status='old')
read (10, iostat=ios) buf
write (*, '(a,i0)') 'iostat = ', ios
end program test
mac56:~/fortran/stream 5> ifort stream-demo-1.f90
mac56:~/fortran/stream 6> ./a.out
iostat = 0
mac56:~/fortran/stream 15> ifort -V
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20091130 Package ID: m_cprof_p_11.1.080
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
-------------------------
iostat should be -1 to indicate end of file, but instead it is zero which is incorrect.
The correct value of -1 can be obtained by (a) decreasing the buffer size, or (b) decreasing the data file size. For larger files, the relevant factor seems to be the amount of excess data requested in the read statement beyond end of file. The mistake is triggered when the excess is roughly 8K to 16K or more. An array size of at least 16K seems to be required. I did not fully investigate the size relationships.
Is this a compiler bug, or am I doing something wrong?
--Dave A.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Update. This problem still occurs in ifort update 7, package ID =m_cprof_p_11.1.089, running on Mac OS 10.6.
I did some additional testing. In the test case above, end of file is not correctly reported for various input files of lengths 8193 through 16383 bytes. The test program as shown tries to read 16384 bytes.
--Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the convenient reproducer, Dave.
I verified the incorrect iostat is returned as described. I reported this to the Fortran Library Developers (see internal tracking id below) and willupdate this thread when I learn more.
(Internal tracking id: DPD200160797)
(Resolution Update on 03/03/2011): This defect is fixed in the Intel Fortran Composer XE 2011 Update1 (2011.1.122 - Mac OS)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This defect is fixed in the Intel Fortran Composer XE 2011 Update1 (2011.1.122 - Mac OS)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
... Thank you!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page