diff options
author | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-15 11:52:44 +0000 |
---|---|---|
committer | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-15 11:52:44 +0000 |
commit | 655c7caa01f108620e59179812e140d94804a0cf (patch) | |
tree | 08aaee7239c0ac44b4cc25e5300419ba6b41659f /libgfortran | |
parent | 182f5311a9e33ce63fce90ab72fd59d6ace6f2b8 (diff) | |
download | gcc-655c7caa01f108620e59179812e140d94804a0cf.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186466 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 12 | ||||
-rw-r--r-- | libgfortran/intrinsics/string_intrinsics_inc.c | 3 | ||||
-rw-r--r-- | libgfortran/io/unit.c | 22 | ||||
-rw-r--r-- | libgfortran/io/unix.c | 2 | ||||
-rw-r--r-- | libgfortran/libgfortran.h | 7 |
5 files changed, 41 insertions, 5 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 15b9f94314b..302895bbb33 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,15 @@ +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. + 2012-04-10 Michael Matz <matz@suse.de> * m4/cshift0.m4 (cshift0_'rtype_code`): Guard use of modulo. diff --git a/libgfortran/intrinsics/string_intrinsics_inc.c b/libgfortran/intrinsics/string_intrinsics_inc.c index b20483da2c4..a1f86b558c8 100644 --- a/libgfortran/intrinsics/string_intrinsics_inc.c +++ b/libgfortran/intrinsics/string_intrinsics_inc.c @@ -44,9 +44,6 @@ extern void concat_string (gfc_charlen_type, CHARTYPE *, gfc_charlen_type, const CHARTYPE *); export_proto(concat_string); -extern gfc_charlen_type string_len_trim (gfc_charlen_type, const CHARTYPE *); -export_proto(string_len_trim); - extern void adjustl (CHARTYPE *, gfc_charlen_type, const CHARTYPE *); export_proto(adjustl); diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index d5029dcac27..6b68e1494d0 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) diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 278decd6775..185936f109d 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -736,7 +736,7 @@ mem_alloc_w4 (stream * strm, int * len) } -/* Stream read function for character(kine=1) internal units. */ +/* Stream read function for character(kind=1) internal units. */ static ssize_t mem_read (stream * s, void * buf, ssize_t nbytes) diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index ea20e140c46..e7f5b711a51 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -791,6 +791,13 @@ internal_proto(fstrcpy); extern gfc_charlen_type cf_strcpy (char *, gfc_charlen_type, const char *); internal_proto(cf_strcpy); +extern gfc_charlen_type string_len_trim (gfc_charlen_type, const char *); +export_proto(string_len_trim); + +extern gfc_charlen_type string_len_trim_char4 (gfc_charlen_type, + const gfc_char4_t *); +export_proto(string_len_trim_char4); + /* io/intrinsics.c */ extern void flush_all_units (void); |