- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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 ?
Thanks.
Olivier
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 ?
Thanks.
Olivier
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
More details please. What does the OPEN look like? What value is returned in IOSTAT?
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
open(unit=10,status='old',iostat=IOK)
write(20,*) IOK
read(10,"(A)") A
write(20,"(A)") A
end program TOTO
The result of the program in fort.20 is:
129
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 ?
Thanks
Olivier
program TOTO
character (len = 50) :: A
integer :: IOK
open(unit=10,status='old',iostat=IOK)
write(20,*) IOK
read(10,"(A)") A
write(20,"(A)") A
end program TOTO
The result of the program in fort.20 is:
129
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 ?
Thanks
Olivier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To give you more details:
I'm on RedHat 8.0 with kernel 2.4.18 and glibc 2.2.93
Olivier
I'm on RedHat 8.0 with kernel 2.4.18 and glibc 2.2.93
Olivier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much Steve !
I did not know it was an extension !
But a very usefull one...
Olivier
I did not know it was an extension !
But a very usefull one...
Olivier

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