Hello,
I'd like to report a possible bug in Fortran Intel Compiler - it seems it doesn't read correctly data in nonadvancing way on a file opened as a formatted stream.
Please consider the attached program. It generates file with lines "This_is_line_no_XXXX" where XXXX is the number of the line. It then reads it back as stream formatted nonadvancing. With the default blocksize, the first problem exhibits at line 780 which is around 16384 bytes which could be the default blocksize, the output is as follows:
[jan@olney npen_build]$ ./test.exe Generating file fread_test.txt Reading fread_test.txt OK Line 1 read 20 >This_is_line_no_0001< OK Line 2 read 20 >This_is_line_no_0002< OK Line 3 read 20 >This_is_line_no_0003< ... OK Line 776 read 20 >This_is_line_no_0776< OK Line 777 read 20 >This_is_line_no_0777< OK Line 778 read 20 >This_is_line_no_0778< OK Line 779 read 20 >This_is_line_no_0779< ERR Line 780 read 40 >This_is_line_no_0780This_is_line_no_0781< ERR Line 781 read 20 >This_is_line_no_0782< ERR Line 782 read 20 >This_is_line_no_0783<
If blocksize=200 as in the attached program, the problem exhibits much more often in all kind of strange ways:
... OK Line 145 read 20 >This_is_line_no_0145< ERR Line 146 read 22 >Thihis_is_line_no_0147< ERR Line 147 read 20 >This_is_line_no_0148< ... ERR Line 193 read 20 >This_is_line_no_0194< ERR Line 194 read 18 >This_is_line_no_01< ERR Line 195 read 20 >This_is_line_no_0196< ... ERR Line 241 read 20 >This_is_line_no_0242< ERR Line 242 read 24 >This_iss_is_line_no_0244< ERR Line 243 read 20 >This_is_line_no_0245< ... ERR Line 289 read 20 >This_is_line_no_0291< ERR Line 290 read 14 >This_is_line92< ERR Line 291 read 20 >This_is_line_no_0293< ...
The output is generated from ifort (IFORT) 15.0.2 20150121 64-bit on Fedora 21, however, the similar behavior can be reproduced on Windows with Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.4.221 Build 20150407
Regards,
Jan