I'm using ifort, and experiencing the file corruption when writing an unformatted binary.
ifort -V prints out "Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.104.22.168 Build 20170411"
Here is simple test code..
program test real*8 :: array(20000) array = 0d0 open(11,file='test.bin',form='unformatted') write(11) 'string' write(11) array close(11) end
compiling this code with compiler flag -convert big_endian and executing the program generates 'test.bin' unformatted binary file.
However, this output file seems to be corrupted.
When removing "write(11) 'string'" line in the code, the file is not corrupted.
When I compile the test code with lower version of ifort, the file is not corrupted.
Is it a compiler bug of this version of ifort, or is there any compiler flag I missed?
I rewrite the test code to generate an error message.
program test real*8 :: array(20000) character(len=6) :: str array = 0d0 str = 'string' open(11,file='test.bin',form='unformatted') write(11) str write(11) array close(11) open(11,file='test.bin',form='unformatted') read(11) str read(11) array close(11) end
Executing the program prints out an error.
"forrtl: severe (67): input statement requires too much data, unit 11"
And, trying to read the 'test.bin' with IDL language prints out "Corrupted f77 unformatted file detected."
Reducing the array size from 20000 to small value like 2000 eliminates the error.
ifort version is 22.214.171.124.