stream removal causing regression on FreeBSD

Janne Blomqvist blomqvist.janne@gmail.com
Fri May 16 17:47:00 GMT 2008


Steve Kargl wrote:
> On Fri, May 16, 2008 at 12:27:56AM +0300, Janne Blomqvist wrote:
>> Steve Kargl wrote:
>>> Janne, Jerry,
>>>
>>> In testing Janne's recent patch to remove the stream buffering scheme,
>>> it appears a regression has crept into libgfortran on FreeBSD.
>>> gfortran.dg/streamio_4.f90 appears to get stuck in a block IO 
>>> operation.  A ktrace on the executable shows repeated blocks of
>>>
>>>  73170 streamio_4.exe CALL  lseek(0x3,0x6a5d8,SEEK_SET)
>>>  73170 streamio_4.exe RET   lseek 435672/0x6a5d8
>>>  73170 streamio_4.exe CALL  ftruncate(0x3,0x6a5d8)
>>>  73170 streamio_4.exe RET   ftruncate 0
>>>  73170 streamio_4.exe CALL  sigprocmask(SIG_BLOCK,0,0x7fffffffd468)
>>>  73170 streamio_4.exe RET   sigprocmask 0
>>>
>>> I believe the change may have undone 
>>>
>>>
>>> 2008-03-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
>>>
>>>         PR libfortran/35632
>>>         * io/transfer.c (data_transfer_init):  Fix whitespace.
>>>         (next_record_w): Truncate the file only if the stream
>>>         position is short of the file end.
>> The issue is that the stream position gets reset to 1 regardless of the
>> POSITION= specifier in the open statement. Hence a ridiculous number of
>> ftruncates+lseeks after the file is reopened with POSITION='append' in
>> streamio_4.f90, and as PR 35632 states ftruncates are slower on FreeBSD
>> so the testcase times out. The attached patch fixes it and regtests
>> cleanly, I'll commit it as obvious tomorrow unless somebody objects:
>>
>> --- a/libgfortran/io/open.c
>> +++ b/libgfortran/io/open.c
>> @@ -611,7 +611,7 @@ new_unit (st_parameter_open *opp, gfc_unit *u,
>> unit_flags * flags)
>>      {
>>        u->maxrec = max_offset;
>>        u->recl = 1;
>> -      u->strm_pos = 1;
>> +      u->strm_pos = file_position (u->s) + 1;
>>      }
>>
>>    memmove (u->file, opp->file, opp->file_len);
>>
> 
> Your patch fixes the problems on FreeBSD.

This fix has now been committed. Thanks for bringing it up, and help 
testing.


-- 
Janne Blomqvist



More information about the Fortran mailing list