[Bug libfortran/43551] [4.4/4.5 Regression] Buffered direct I/O reads wrong record
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Mar 28 11:56:00 GMT 2010
------- Comment #10 from burnus at gcc dot gnu dot org 2010-03-28 11:56 -------
And the culprit is unit 30 ("$HOME/tmp/_phsi.ebar" alias unit=iuebar), which is
a binary file (672000 bytes), which is automatically deleted
(PH/close_phq.f90).
The file is opened with: form='unformatted', access='direct', recl=22400
(= 2800 * DIRECT_IO_FACTOR w/ DIRECT_IO_FACTOR = 8 for real(8).)
* * *
! Test case:
implicit none
integer, parameter :: size = 2800 ! << needs to be large enough
real(8) :: vec1(size,30), dummy(size)
integer i
CALL RANDOM_NUMBER(vec1)
open(99, file='test.dat', form='unformatted', access='direct', recl=size*8)
do i = 1, 10
write(99,rec=i) vec1(:,i)
write(99,rec=i+10) vec1(:,i+10)
write(99,rec=i+20) vec1(:,i+20)
end do
do i = 1, 10
read(99,rec=i) dummy
if (any (dummy /= vec1(:,i))) call abort()
read(99,rec=i+10) dummy
if (any (dummy /= vec1(:,i+10))) call abort()
read(99,rec=i+20) dummy
if (any (dummy /= vec1(:,i+20))) call abort() ! << aborts here for rec = 21
end do
close(99, status='delete')
end
* * *
Closer examination shows that reading rec = 1, rec = 11, rec = 21 returns the
record 1, 11, 30. That is: The third read returns the *last* record instead of
the 21th!
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[4.4/4.5 Regression] I/O |[4.4/4.5 Regression]
|regression (wrong values |Buffered direct I/O reads
|with Quantum Espresso) |wrong record
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43551
More information about the Gcc-bugs
mailing list