[patch, libfortran][Regression] PR43265 No EOF condition if reading with '(x)' from an empty file
Jerry DeLisle
jvdelisle@verizon.net
Mon Mar 8 07:14:00 GMT 2010
Hi,
The attached patch fixes this PR by extracting the code in read_sf used by
read_x and putting it into read_x. This re-factoring includes getting rid of
the no_error parameter from read_sf and trimming down the code to a minimum
needed by read_x. Handling of EOF and EOR conditions within read_x are now
tailored for read_x. This adds a check of the item count so that trailing X
format specifiers will not produce an EOF, but leading X format specifiers will.
The two test cases given test these conditions.
I also deleted an incorrect use of hit_eof found in read_sf. This eliminated a
wrong code found when the format is modified from (1x,a3,1x,a3,1x,a3,1x,a3,10x)
to (1x,a3,1x,a3,1x,a3,1x,a3) in read_x_past.f, updated to test this.
Regression tested and NIST tested on x86-64. OK for trunk.
Regards,
Jerry
2010-03-07 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/43265
* io/read.c: Include fbuf.h and unix.h to enable lower level I/O for
read_x. (read_x): Replace the use of read_sf with equivalent lower level
I/O, eliminating unneeded code and handling EOF and EOR conditions.
* io/io.h: Revise prototype for read_sf.
* io/transfer.c (read_sf): Delete no_error parameter and all uses of it.
(read_block_form): Likewise.
(next_record_r): Delete wrong code call to hit_eof.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr43265.diff
Type: text/x-patch
Size: 4853 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100308/92869fc1/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: read_x_eof.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100308/92869fc1/attachment.f90>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: read_x_past.f
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100308/92869fc1/attachment.ksh>
More information about the Gcc-patches
mailing list