| Submitter | Thomas Koenig |
|---|---|
| Date | Sept. 24, 2012, 9:50 p.m. |
| Message ID | <5060D5A0.4000105@netcologne.de> |
| Download | mbox | patch |
| Permalink | /patch/186582/ |
| State | New |
| Headers | show |
Comments
Hi Thomas, > not much to say, the patch is pretty straightforward. > Regression-tested. OK for trunk? I'm not much of a libgfortran or I/O expert, but after all this looks ok to me. Thanks for the patch! Cheers, Janus > 2012-09-24 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-24 Thomas König <tkoenig@gcc.gnu.org> > > PR fortran/52724 > * gfortran.dg/internal_readwrite_3.f90: New test.
Hi Janus, > I'm not much of a libgfortran or I/O expert, but after all this looks > ok to me. Thanks for the patch! Committed, thanks. What to people think about backporting to 4.7? It is a wrong-code issue, if a rather obscure corner. If there's no feedback within a few days, I think I'll close the PR. Thomas
Patch
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;
Hello world, not much to say, the patch is pretty straightforward. Regression-tested. OK for trunk? Thomas 2012-09-24 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-24 Thomas König <tkoenig@gcc.gnu.org> PR fortran/52724 * gfortran.dg/internal_readwrite_3.f90: New test.