Severe problem with formatted write
Paul Thomas
paulthomas2@wanadoo.fr
Mon Aug 1 19:45:00 GMT 2005
Francois-Xavier
> Hi,
>
>>
>> I'd like to help (for example, reverting the patches you quote one by
>> one until we find the right one), but I can't see the failure you
>> mention on x86_64-linux (which is the only fast computer I have access
>> too right now).
>
I finally got some time to do just that:
Working up from 16th March, I hit the right one with:
2005-04-09 Bud Davis <bdavis@gfortran.org>
Steven G. Kargl <kargls@comcast.net>
PR fortran/19872
* io/transfer.c (data_transfer_init): truncate an existing
file on the first write.
transfer.c:1170
/* Overwriting an existing sequential file ?
it is always safe to truncate the file on the first write */
if (g.mode == WRITING
&& current_unit->flags.access == ACCESS_SEQUENTIAL
&& current_unit->current_record == 0)
struncate(current_unit->s);
If I comment out the code, the problem (documented below) goes away.
Expanding the macro by hand does not help, so the (s)->truncate
function must be broken, for RH9 at least.
Will investigate further.
Paul T
Documenation of problem:
integer, parameter :: nloops =1
open (9, file = "foo.out")
write (9, *) "The foobar test"
write(9,*) 42, 42, 42, 40
do i = 1, nloops
write (9,*) "step=", i
end do
write(9,*)' The end of the foobar test'
close (9)
STOP
END
produces
<86 NULLS> The foobar test
42 42 42 40
step= 1
The end of the foobar test
Upping the parameter to nloops, results in, at least 1400 NULLS on the
first line, followed by
step= 429
step= 430
step= 431
step= 432
....
to a correct conclusion.
removing the above patch results in the correct output.
More information about the Fortran
mailing list