[Patch, Fortran] PR56737 - Fixing a bug in the I/O format cache handling
Tobias Burnus
burnus@net-b.de
Thu Mar 28 10:21:00 GMT 2013
Tobias Burnus wrote:
> b) To copy the format string
>
> The attached patch does the latter. The current hashing algorithm
> avoids hash collisions by checking whether the value is exactly the
> same - and the value is given by the format string. Thus, instead of
> copying the string when storing the format in the cache, the patch
> copies it now before calling parse_format_list.
Re-reading what Jerry wrote, I realized that the current code disables
format caching for strings (but not for Holleriths). With my patch,
that's no longer required. Attached is a missed-optimization patch.
> Bootstrapped and regtested on x86-64-gnu-linux.
> OK for the trunk and the 4.6/4.7/4.8 branches?
(Or should the follow-up patch only applied to the trunk?)
BTW: Without the follow up patch, the following is a memory leak as
parse_format_list might set format_cache_ok to false:
> if (fmt->error)
> {
> format_error (dtp, NULL, fmt->error);
> + if (format_cache_ok)
> + free (dtp->format);
Thus, if the follow-up patch is not backported, it should be changed to
"!is_internal_unit (dtp)", which is the initial condition for
format_cache_ok.
Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fmt-cache-string.diff
Type: text/x-patch
Size: 2971 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130328/33bdd7ce/attachment.bin>
More information about the Fortran
mailing list