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
+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.
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);
__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. */
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)
}
-/* 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)
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);