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

Jerry DeLisle jvdelisle@verizon.net
Sat Mar 10 06:30:00 GMT 2007

:addpatch fortran:


This problem was not quite what I originally thought.  The function test_endfile 
was setting the endfile flag to AT_ENDFILE for the test case provided in the PR.

Commenting out test_endfile in st_rewind resolves the test case but regresses 
dev_null.f90.  All other test cases past.  So, it appears that test_endfile is 
needed for the special case when rewinding /dev/null.  This seems weird to me to 
begin with, but how does one determine that a file is /dev/null?

Regardless, the attached patch resolves this issue by adding the additional 
condition that the file_length is zero before setting end_file to AT_ENDFILE.

Fully regression tested on x86-64-Gnu/Linux.

On the test case, I will convert the case in the PR to an equivalent testsuite 

OK for trunk and then 4.2 after the branch freezes and reopens later?



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

	PR libgfortran/31052
	* io/open.c (test_endfile): Add condition of file_length equal to zero
	to prevent incorrect setting of endfile flag to AT_ENDFILE.
	(new_unit): Fix typo in comment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr32052.diff
Type: text/x-patch
Size: 1216 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070310/80fd8a16/attachment.bin>

More information about the Gcc-patches mailing list