diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2012-09-29 17:38:46 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2012-09-29 17:38:46 +0000 |
commit | 7c0de7535345f7d271c89d5121c7edfabd1e79f7 (patch) | |
tree | ee47c83148e108305938eb2264d383e28dae885d /libgfortran/io | |
parent | df98376a391d42fa570b557391199b041abaeb42 (diff) | |
download | gcc-7c0de7535345f7d271c89d5121c7edfabd1e79f7.zip gcc-7c0de7535345f7d271c89d5121c7edfabd1e79f7.tar.gz gcc-7c0de7535345f7d271c89d5121c7edfabd1e79f7.tar.bz2 |
re PR fortran/52724 (Internal read with character(kind=4) data)
2012-09-29 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/52724
* list_read.c (next_char): Handle kind=4 characters.
* unix.c (open_internal4): Correct lenth of internal file.
2012-09-29 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/52724
* gfortran.dg/internal_readwrite_3.f90: New test.
From-SVN: r191854
Diffstat (limited to 'libgfortran/io')
-rw-r--r-- | libgfortran/io/list_read.c | 13 | ||||
-rw-r--r-- | libgfortran/io/unix.c | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 9d301d6..403e719 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -199,9 +199,16 @@ next_char (st_parameter_dt *dtp) if (is_internal_unit (dtp)) { - char cc; - length = sread (dtp->u.p.current_unit->s, &cc, 1); - c = cc; + /* Check for kind=4 internal unit. */ + if (dtp->common.unit) + length = sread (dtp->u.p.current_unit->s, &c, sizeof (gfc_char4_t)); + else + { + char cc; + length = sread (dtp->u.p.current_unit->s, &cc, 1); + c = cc; + } + if (length < 0) { generate_error (&dtp->common, LIBERROR_OS, NULL); diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 1a9faea..805d4bb 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -959,7 +959,7 @@ open_internal4 (char *base, int length, gfc_offset offset) s->buffer = base; s->buffer_offset = offset; - s->active = s->file_length = length; + s->active = s->file_length = length * sizeof (gfc_char4_t); s->st.vptr = &mem4_vtable; |