[Bug fortran/29053] New: Consecutive STREAM I/O file positions mixed up
jvdelisle at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Sep 13 02:33:00 GMT 2006
With the following test case and no optimization, the dtp pointer is duplicated
resulting in the dtp-rec values getting mixed up during consecutive writes:
program avl
implicit none
real dt, t, a(10)
integer i, place
dt = 1.e-6
a = real( (/ (i, i=1, 10) /) )
open(unit=11, file='a.dat', access='stream')
open(unit=12, file='b.dat', access='stream')
do i = 1, 10
t = i * dt
write(11) t
write(12) a
end do
close(11)
close(12)
end program avl
Test case from Steve Kargl. The end result should be a.dat file of length 40
and b.dat file of length 400. The result is:
-rw-rw-r-- 1 jerry jerry 396 Sep 12 19:32 a.dat
-rw-rw-r-- 1 jerry jerry 436 Sep 12 19:32 b.dat
With -O1 this program works fine.
With gdb you can see the transfer calls given the same dtp pointer for both
files.
--
Summary: Consecutive STREAM I/O file positions mixed up
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jvdelisle at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29053
More information about the Gcc-bugs
mailing list