[patch, libfortran] PR44477 Sequential I/O with END FILE: File position should be at EoF

Jerry jvdelisle@verizon.net
Fri Jun 18 16:03:00 GMT 2010


On 6/18/2010 12:20 AM, Tobias Burnus wrote:
> On 06/18/2010 05:19 AM, Jerry DeLisle wrote:
>    
>> This patch adds checks and issues errors if ENDFILE is executed when
>> the file is already positioned after thee EOF marker.  It also gives
>> errors if a read or write is attempted when positioned after the EOF
>> marker.
>> Another problem is that ENDFILE should create the file if it does not
>> exist.
>>
>> Regression tested on x86-64-gnu-linux.  Test cases provided.
>> OK for trunk?
>>      
> Thanks for the patch. OK after considering the following items.
>
> You seem to have copied the initialization (if no file exists) from
> data_transfer_init.
> a) The /* Is it unformatted?  */ comment does not make sense, can you
> remove it?
>    
Already removed it, I was thinking the same thing.

> b) You use GFC_CONVERT_NATIVE; shouldn't that use the environment
> variable / compile-time option? In data_transfer_init, one checks
> "get_unformatted_convert (dtp->common.unit)" and compile_options.convert.
>    
This code is only executed if the file does not already exist. The 
default setting is formatted I/O. Convert applies unformatted.  
Regardless, any following OPEN, READ, or WRITE will set the flags if needed.

Jerry



More information about the Fortran mailing list