diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2012-04-15 11:52:44 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2012-04-15 11:52:44 +0000 |
commit | 79617d7e2e4e868da8bca85ea3d6d61ad1e89e4c (patch) | |
tree | 08aaee7239c0ac44b4cc25e5300419ba6b41659f /libgfortran/io/unit.c | |
parent | 9b63dcab1e9c9243604c8762ff9145951e485b9e (diff) | |
download | gcc-79617d7e2e4e868da8bca85ea3d6d61ad1e89e4c.zip gcc-79617d7e2e4e868da8bca85ea3d6d61ad1e89e4c.tar.gz gcc-79617d7e2e4e868da8bca85ea3d6d61ad1e89e4c.tar.bz2 |
re PR libfortran/38199 (missed optimization: I/O performance)
2012-04-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/38199
PR libfortran/50673
* intrinsics/string_intriniscs_inc.c (string_len_trim):
Remove prototypes for string_len_trim and move to...
* libgfortran.h (string_len_trim): ... here and
(string_len_trim_char4): ...here.
* io/unit.c: For non-array internal arrays where we do reading,
adjust the record length to the last non-blank character.
* io/unix.c: Fix typo.
From-SVN: r186466
Diffstat (limited to 'libgfortran/io/unit.c')
-rw-r--r-- | libgfortran/io/unit.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index d5029dc..6b68e14 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -397,7 +397,7 @@ get_internal_unit (st_parameter_dt *dtp) __gthread_mutex_lock (&iunit->lock); iunit->recl = dtp->internal_unit_len; - + /* For internal units we set the unit number to -1. Otherwise internal units can be mistaken for a pre-connected unit or some other file I/O unit. */ @@ -415,6 +415,26 @@ get_internal_unit (st_parameter_dt *dtp) start_record *= iunit->recl; } + else + { + /* If we are not processing an array, adjust the unit record length not + to include trailing blanks for list-formatted reads. */ + if (dtp->u.p.mode == READING && dtp->format == NULL) + { + if (dtp->common.unit == 0) + { + dtp->internal_unit_len = + string_len_trim (dtp->internal_unit_len, dtp->internal_unit); + iunit->recl = dtp->internal_unit_len; + } + else + { + dtp->internal_unit_len = + string_len_trim_char4 (dtp->internal_unit_len, dtp->internal_unit); + iunit->recl = dtp->internal_unit_len; + } + } + } /* Set initial values for unit parameters. */ if (dtp->common.unit) |