[Bug fortran/52724] Internal read with character(kind=4) data
tkoenig at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Sep 24 18:07:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52724
--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-09-24 18:07:17 UTC ---
This patch looks promising:
Index: list_read.c
===================================================================
--- list_read.c (Revision 191649)
+++ list_read.c (Arbeitskopie)
@@ -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);
Index: unix.c
===================================================================
--- unix.c (Revision 191649)
+++ unix.c (Arbeitskopie)
@@ -959,7 +959,7 @@ open_internal4 (char *base, int length, gfc_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;
More information about the Gcc-bugs
mailing list