[patch, libgfortran] PR43265 Follow-up patch for several corner cases
Jerry DeLisle
jvdelisle@verizon.net
Wed Mar 17 04:36:00 GMT 2010
Hi Folks,
I hope this gets them all. This patch corrects a number of deficiencies related
to end of file conditions with no record markers or with padding.
I believe the ChangeLog entry explains it well enough. The two attached test
cases capture the essence of the problems. The two namelist test cases are
changed only to prevent an infinite loop if down the road we break this. (Found
when developing the patch).
While at it, I factored the code a little. This helped to isolate internal from
external code during debugging and seemed to make sense to do.
Regression tested on x86-64-linux-gnu.
OK for trunk and then backport to 4.4
Regards,
Jerry
2010-03-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/43265
* io/io.h: Delete prototype for read_sf, making it static.
* io/read.c (read_x): Modify to call hit_eof if PAD="no".
* io/transfer.c (read_sf_internal): New static function extracted from
read_sf for use on internal units only.
(read_sf): New factoring of this function, make it static. Add special
conditions for EOF based on ADVANCE="no", PAD="no", and whether any
bytes have been previously read from the record.
(read_block_form): Modify to call read_sf or read_sf_internal.
(next_record_r): Add a done flag similar to next_record_w. Call hit_eof
if internal array unit next record returns finished, meaning an EOF was
found and not done, ie not the last record expected. For external
units call hit_eof if item_count is 1 or there are no pending spaces.
(next_record): Update call to next_record_r.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: end-corners-2.diff
Type: text/x-patch
Size: 6740 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100317/5b331807/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: read_empty_file.f
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100317/5b331807/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: read_eof_all.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100317/5b331807/attachment.f90>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: namelist_27.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100317/5b331807/attachment-0001.f90>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: namelist_28.f90
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100317/5b331807/attachment-0002.f90>
More information about the Gcc-patches
mailing list