[patch, libgfortran] PR31052 Bad IOSTAT values when readings NAMELISTs past EOF

Jerry DeLisle jvdelisle@verizon.net
Wed Mar 14 04:45:00 GMT 2007


:ADDPATCH fortran:

Here is a final installment with test case.  I eliminated the test_endfile 
function.  Then I added a new function is_special () that returns true if the 
special file bit is set in the stream structure.

To retain compatibility with g77 behavior and previous versions of gfortran, I 
used this new function in st_rewind.  The reason this is necessary is because a 
read from /dev/null should always return EOF no matter what and if a user for 
some reason does a rewind, we won't get the EOF because the following rewind 
sets the NO_ENDFILE flag.

I have added some notes to identify where additional logic can be added for 
special files in the future with rewind.  We could, for example, generate a 
diagnostic message.

I also cleaned up some comments and whitespace here and there.

Regression tested on x86-64-Gnu/Linux.  New test case provided.

OK for trunk? and 4.2 after freeze and a little time for exercising on trunk?

Regards,

Jerry

2007-03-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/31052
	* io/file_position (st_rewind): Fix comments. Remove use of
	test_endfile. Don't seek if already at 0 position.  Use new is_special
	function to set endfile state.
	* io/open.c (test_endfile): Delete this function.
	* io/io.h: Delete prototype for test_endfile.  Add prototype
	for is_special.
	* io/unix.c (is_special): New function. Fix whitespace.
	* io/transfer.c (next_record_r): Remove use of test_endfile.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr31052-c.diff
Type: text/x-patch
Size: 6828 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070314/1f18cdd4/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: namelist_27.f90
Type: text/x-fortran
Size: 2831 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070314/1f18cdd4/attachment-0001.bin>


More information about the Gcc-patches mailing list