[patch, libgfortran] PR53029 missed optimization in internal read (without implied-do-loop)
Jerry DeLisle
jvdelisle@charter.net
Sun May 28 23:16:00 GMT 2017
Hi all,
The problem here is that we never set the err return to LIBERROR_END in all
cases. For the example case we are detecting the EOF condition inside the
read_integer procedure and it gets acted on correctly at higher levels in the
code. Consequently in the big loop over the array where we call
list_formatted_read_scalar, we never returned an error code so we never exited
the loop early.
The patch tests for the EOF first locally as before, but then returns the error
flags set in dtp->common.flags which are set globally in the individual read
procedures whene hit_eof is called.
Regression tested on x86_64. I have added a test case which will check the
execution time of the loop. The previous results of the REAd were correct, just
took a long time on large arrays.
OK for trunk?
Regards,
Jerry
2017-05-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/35339
* list_read.c.c (list_formatted_read_scala): Set the err return
value to the common.flags error values.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr35339.diff
Type: text/x-patch
Size: 784 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170528/96a9d524/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: read_5.f90
Type: text/x-fortran
Size: 669 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20170528/96a9d524/attachment-0001.bin>
More information about the Fortran
mailing list