Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

problem with advance='no'

dave_frank
Beginner
427 Views
character :: ch
integer :: commas
open (1,file='test.dat')
commas = 0
do
read (1,'(a)',advance='no',end=100,err=101) ch
if (ch == ',') commas = commas +1
end do

above will crash at record 1 crlf detect (err= is ignored) saying "end of record during read"
A couple CLF experts say above shud be able to scan the file for commas, but apparently not in cvf6.6b ??


0 Kudos
2 Replies
Steven_L_Intel1
Employee
427 Views
You need an EOR= specification. The standard says that EOR and EOF are not "error conditions", and thus the ERR= branch is not taken. There's actually a few paragraphs about this in the release notes.

Steve
0 Kudos
Steven_L_Intel1
Employee
427 Views
Here's the text from the release notes:

In order to conform with clarified wording in the Fortran standard, the compiler has been changed so that when a READ statement encounters an end-of-file condition, and there is no END= specifier but there is an ERR= specifier, the ERR= branch is NOT taken. Similarly, if an end-of-record condition occurs but there is no EOR= specifier, an ERR= branch is not taken.

A further behavior change, to conform with the standard, has been implemented. If an EOF (or EOR) condition occurs and there is not an IOSTAT= or END= (or EOR= in the case of EOR) specifier, the program is terminated with an error message.

Steve
0 Kudos
Reply