problem with iostat in an open instruction

problem with iostat in an open instruction


I've installed an evaluation of Fortran Compiler 7.0 for Linux.
It seems that an OPEN instruction on existing files does not work with IOSTAT. My program works as if the files to open were not present.
I've not this problem with other compilers...

What could be wrong ?

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

More details please. What does the OPEN look like? What value is returned in IOSTAT?


Steve - Intel Developer Support

To give you more details, here is a sample program to read the content of an existing file fort.10 ("this is a test"). The program returns the value of IOSTAT in fort.20 and writes the string read in this file.

program TOTO

character (len = 50) :: A
integer :: IOK

write(20,*) IOK
read(10,"(A)") A
write(20,"(A)") A

end program TOTO

The result of the program in fort.20 is:
this is a test

The value of IOSTAT should be 0 !
If I use another compiler (ABSOFT, LAHEY) I've not this problem (IOSTAT equals 0).
I suppose there has been a problem in the installation of the evaluation of Intel Fortran. Which library could be concerned ?


To give you more details:
I'm on RedHat 8.0 with kernel 2.4.18 and glibc 2.2.93


How very interesting. This is not a bug, but rather Intel Fortran is choosing not to support a very common extension to the standard - so common that I didn't even realize it WAS an extension.

The standard says, for OPEN (FILE=), "If this (FILE=) specifier is omitted and the unit is not connected to a file, the STATUS= specifier shall be specified with a value of SCRATCH; in this case, the connection is made to a processor-dependent file."

In other words, your OPEN that gives STATUS="OLD" but no FILE= assumes an extension that a default FILE= is provided. Many implementations do that, but not Intel Fortran (at least not now - when the Compaq Fortran libraries are integrated in a future release, this extension will come with them.)

Your program is non-standard - you should either specify a FILE= in the OPEN or do away with the OPEN entirely.

By the way, if you had looked up IOSTAT error 129 in the User's Guide, you would have seen a precise explanation of what caused the error.


Steve - Intel Developer Support

Thank you very much Steve !

I did not know it was an extension !
But a very usefull one...


Leave a Comment

Please sign in to add a comment. Not a member? Join today