Hello,
I am using ifort (IFORT) 12.0.0 at our linux server, and I am experiencing a strange behavior with stream access I/O.
A minimal-size sample code would look as follows:
program inq_pos_test
implicit none
! integer,parameter :: nbuf=2**14-1
integer,parameter :: nbuf=2**14
integer :: offset
character(len=nbuf) :: str
offset=1
open(11,file='./input.txt',form='unformatted',access='stream')
read(11,pos=offset) str(1:nbuf)
inquire(11,pos=offset)
write(*,'(a,i8,a,i8)') 'pos after reading ',nbuf,' bytes=',offset
close(11)
end program inq_pos_test
where './input.txt' is a 2MB ascii file. Definately I would expect the final value of offset to be (nbuf+1). This is true when nbuf = 2**14 - 1 (= 16383):
pos after reading 16383 bytes= 16384
However, it returns a strange value if nbuf = 2**14 (= 16384):
pos after reading 16384 bytes= 8193
where 8193 = 2**13 + 1. Seems like offset is always 8193 for any values of nbuf >= 2**14.
First of all, I would like to know whether this is our system-specific problem or not. Could anyone check whether this could be reproduced?
Thanks in advance.
ps. gfortran seems to work as expected for any values of nbuf.