Very large unformatted records in files

Very large unformatted records in files

We're trying to understant what the Intel compiler (on Mac OS X) is doing forrecords larger than 4GB in unformatted files, which cause the integer*4 leading and trailing record lengths to overflow. According to Intel documentation (Intel Fortran Compiler User and Reference Guides, pp. 216-218 ), seems to indicate that the records will be subdivided into sub records. The leading length field has the sign bit set to 1, while the trailing one has the sign bit set to zero for subrecord 1. For the last subrecord, this is flipped while for intermediate subrecords the sign bit is set for both leading and trailing field. However, when you actually look at the data, the record lengths make no sense. There are actually 3 fields in-between subrecords and the record lengths dont look right either. We would like to know how Intel actually is decoding these files as it does not seem to match the documentation.

Here is a simple example compiled with ifort 11.1 20100806 or 12.0.2on the Mac:

program main
integer n,nx, iw(2**29+2)
nx = 2**29+2
do n=nx-4,nx
iw(n) = 2

write(15) (iw(n),n=1,nx)
end program main

Using od to look at the values in the file:

% od -i fort.15

0000000 -2147483639 1 1 1
0000020 1 1 1 1
17777777760 1 1 -150994942 293601279
20000000000 0 2 2 2
20000000020 2 -17

As one can see, there are 3 fields: -150994942 293601279 0 between the two subrecords. And in this case, one of the records appears to be zero!

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