Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29274 Diskussionen

ifort 8.0 bug while reading direct unformatted file

otem234
Einsteiger
541Aufrufe

I have a piece of code which works for many years before I updated to ifort 8.0. The code is attached below. It seems that ifort has a bug to read direct access unformatted file. I have tested this code with the following fortran compilers:

o ifc version 5.0, 6.0, 7.1 and get "6";
o pgf90 version 5.1, get "6";
o g95, get "6";
o ifort 8.0, get "3"??

How should I avoid this problem with ifort 8.0?

Thanks.

Fortran 90 code attached:

filename ='test.data'
irow = 357 ! what we want
icol = 1086

WRITE(0,'(a,a)') ' Opening ',TRIM(filename)
OPEN (UNIT=lun, FILE=TRIM(filename), ACCESS='DIRECT', &
FORM='UNFORMATTED', STATUS='OLD', &
RECL=incol)

READ (lun, REC=irow) (inbuf(i), i=1,incol)
outarray = ICHAR(inbuf(icol))
CLOSE (lun)

print *, outarray

0 Kudos
3 Antworten
Steven_L_Intel1
Mitarbeiter
541Aufrufe
Are you aware that in Intel Fortran 8.0, the unit of RECL= is in four-byte units, the same as in Compaq Fortran? Try compiling with
-assume byterecl
and see if that helps. Since you did not supply the data file in question, I can't try it myself.

I will also note that ifort 8.0 is rather old at this point. 8.1.030 is the current version.

Message Edited by sblionel on 05-19-2005 04:46 PM

otem234
Einsteiger
541Aufrufe
Hi Steve,
Thank you very much. '-assume byterecl' does the trick. I do not know record length is in longwords instead of bytes.

Henry.
Steven_L_Intel1
Mitarbeiter
541Aufrufe
Please read Migrating Applications from Intel Fortran Compiler 7.1 to Intel Fortran Compiler 8.1. Also, please read the compiler release notes.
Antworten