(j3.2006) Partial write in record with nonadvancing I/O
Rafik Zurob
rzurob
Wed Feb 29 13:23:28 EST 2012
Hi
I've been following this discussion closely and would like to add my voice
to that of the ones saying that this section of the standard is not very
clear. (Maybe it's not ambiguous, but it's not very clear.)
I'm also interested in the expected output with stream access. For
example, for the original test case from Robert and Tobias, XLF truncates
the record after MONP with sequential access, but keeps the rest of the
record (MNOPIJKL) with stream access. For the left side of the record, we
had a bug in our implementation of interp 27, which I've now fixed.
Here is the XLF 13.1 behaviour for the examples in Tobias's email. I've
also added the results from using stream access
a) Nonadvancing READ, nonadvancing WRITE
----------------------------------------
(v) IBM XL Fortran
mnop<
mnop<
b) Nonadvancing READ, advancing WRITE
-------------------------------------
(ii) gfortran 4.7, PGI 11.5, IBM XL Fortran
mnop
<
mnop
<
c) No READ, nonadvancing WRITE
------------------------------
(iii) g95 0.93, IBM XL Fortran
mnop<
mnop<
d) No READ, advancing WRITE
------------------------------
(ii) gfortran 4.7, PGI 11.5, g95, ifort 12.1, IBM XL Fortran
mnop
<
mnop
<
------------------------------------------------
With stream access instead of sequential access:
------------------------------------------------
a) Nonadvancing READ, nonadvancing WRITE
----------------------------------------
(i) IBM XL Fortran
mnopEFGHIJKL
1234567890ab
<
mnopEFGHIJKL
1234567890ab
<
(ii) gfortran 4.5.3 (cygwin)
mnopEFGHIJKL
1234567890ab
<
mnop
FGHIJKL
1234567890ab
<
b) Nonadvancing READ, advancing WRITE
-------------------------------------
(i) IBM XL Fortran
mnop
FGHIJKL
1234567890ab
<
mnop
FGHIJKL
1234567890ab
<
(ii) gfortran 4.5.3 (cygwin)
mnop
<
mnop
<
c) No READ, nonadvancing WRITE
------------------------------
(i) IBM XL Fortran
mnopEFGHIJKL
1234567890ab
<
mnopEFGHIJKL
1234567890ab
<
(ii) gfortran 4.5.3 (cygwin)
mnopEFGHIJKL
1234567890ab
<
mnop
FGHIJKL
1234567890ab
<
d) No READ, advancing WRITE
------------------------------
(i) IBM XL Fortran
mnop
FGHIJKL
1234567890ab
<
mnop
FGHIJKL
1234567890ab
<
(ii) gfortran 4.5.3 (cygwin)
mnop
<
mnop
<
Regards
Rafik
j3-bounces at j3-fortran.org wrote on 29/02/2012 09:15:44 AM:
> From: Tobias Burnus <burnus at net-b.de>
> To: j3 at j3-fortran.org
> Date: 29/02/2012 09:18 AM
> Subject: Re: (j3.2006) Partial write in record with nonadvancing I/O
> Sent by: j3-bounces at j3-fortran.org
>
> Dear all,
>
> On Mon, Feb 27, 2012 at 10:19:09AM +0100, Tobias Burnus wrote:
> > at comp.lang.fortran, Bob Corbett queried what the different
> compilers output
> > for the following program - and the replies showed that the
> results vary a lot. Cf.
> > http://groups.google.com/group/comp.lang.fortran/browse_thread/
> thread/694050b1806da367
>
> I have just realized that the compilers already produce quite
> different results
> for the following program. The program comes in four variants:
>
> * With and without a nonadvancing READ, which places the position in
> the current record.
>
> * With advancing and with nonadvancing WRITE.
>
> !--------------------------------------------------------
> OPEN (10, FILE='XXX', status='replace')
> WRITE(10, '(a)') 'ABCDEFGHIJKL'
> WRITE(10, '(a)') '1234567890ab'
> close (10)
>
> OPEN (10, FILE='XXX', position='REWIND', status='old', &
> action='readwrite')
> ! READ(10, '(tl1)', advance='no') ! << add optionally
> WRITE (10, '(A)', ADVANCE='NO') 'mnop' ! << optionally: advance='yes'
> FLUSH (10)
> call execute_command_line ('cat XXX; echo "<"')
> close(10)
> call execute_command_line ('cat XXX; echo "<"')
> end
> !--------------------------------------------------------
>
> (Replace "flush(10)" by "call flush(10)" and "execute_command_line"
> by "system" if your compiler supports those instead of the new
> F2003 statement/F2008 intrinsic. On Windows, the "cat" could be
> replaced by "type". I had to do some of those for the results below.)
>
>
> Upon special request, I refrain from quoting the standard. However, I am
> interested, which output you expect and whether the program is valid or
not.
>
>
> Results for several compilers:
>
>
> a) Nonadvancing READ, nonadvancing WRITE
> ----------------------------------------
>
> (i) Pathscale 3.2.99, Cray 7.1, Open64 4.2
>
> mnopEFGHIJKL
> 1234567890ab
> <
> mnopEFGHIJKL
> <
>
>
> (ii) gfortran 4.7, PGI 11.5,
>
> mnop<
> mnop
> <
>
>
> (iii) g95 0.93
>
> ABCDEFGHIJKL
> mnop<
> ABCDEFGHIJKL
> mnop<
>
>
> (iv) ifort 12.1 [also with "-assume nobuffered_io"]
>
> ABCDEFGHIJKL
> 1234567890ab
> <
> ABCDEFGHIJKL
> mnop
> <
>
>
> b) Nonadvancing READ, advancing WRITE
> -------------------------------------
>
> (i) Pathscale 3.2.99, Cray 7.1, Open64 4.2
>
> mnopEFGHIJKL
> 1234567890ab
> <
> mnopEFGHIJKL
> <
>
>
> (ii) gfortran 4.7, PGI 11.5,
>
> mnop
> <
> mnop
> <
>
>
> (iii) g95 0.93, ifort 12.1
>
> ABCDEFGHIJKL
> mnop
> <
> ABCDEFGHIJKL
> mnop
> <
>
>
> c) No READ, nonadvancing WRITE
> ------------------------------
>
> (i) Pathscale 3.2.99, Cray 7.1, Open64 4.2
>
> mnopEFGHIJKL
> 1234567890ab
> <
> mnop
> <
>
>
> (ii) gfortran 4.7, PGI 11.5,
>
> mnop<
> mnop
> <
>
>
> (iii) g95 0.93
>
> mnop<
> mnop<
>
>
> (iv) ifort 12.1 [-assume nobuffered_io]
>
> ABCDEFGHIJKL
> 1234567890ab
> <
> mnop
> <
>
>
> d) No READ, advancing WRITE
> ------------------------------
>
> (i) Pathscale 3.2.99, Cray 7.1, Open64 4.2
>
> mnop
> FGHIJKL
> 1234567890ab
> <
> mnop
> <
>
>
> (ii) gfortran 4.7, PGI 11.5, g95, ifort 12.1
>
> mnop
> <
> mnop
> <
>
>
> Tobias
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
>
More information about the J3
mailing list