Commit 93896498 by Jerry DeLisle

re PR libfortran/61640 (KIND=4 Character Array Internal Unit Read Fail)

2014-06-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/61640
	* io/list_read.c (next_char_internal): Adjust the read length to
	a single wide character. (eat_spaces): Add missing paren. 
	* io/unix.c (mem_read4): Use the correct mem_alloc function for
	wide character internal reads.

From-SVN: r212118
parent 7d90d0e1
2014-06-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/61640
* io/list_read.c (next_char_internal): Adjust the read length to
a single wide character. (eat_spaces): Add missing paren.
* io/unix.c (mem_read4): Use the correct mem_alloc function for
wide character internal reads.
2014-06-28 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> 2014-06-28 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/29383 PR fortran/29383
......
...@@ -273,7 +273,7 @@ next_char_internal (st_parameter_dt *dtp) ...@@ -273,7 +273,7 @@ next_char_internal (st_parameter_dt *dtp)
/* Get the next character and handle end-of-record conditions. */ /* Get the next character and handle end-of-record conditions. */
if (dtp->common.unit) /* Check for kind=4 internal unit. */ if (dtp->common.unit) /* Check for kind=4 internal unit. */
length = sread (dtp->u.p.current_unit->s, &c, sizeof (gfc_char4_t)); length = sread (dtp->u.p.current_unit->s, &c, 1);
else else
{ {
char cc; char cc;
...@@ -399,7 +399,7 @@ eat_spaces (st_parameter_dt *dtp) ...@@ -399,7 +399,7 @@ eat_spaces (st_parameter_dt *dtp)
{ {
for (i = 0; i < dtp->u.p.current_unit->bytes_left; i++) for (i = 0; i < dtp->u.p.current_unit->bytes_left; i++)
{ {
if (dtp->internal_unit[offset + i * sizeof (gfc_char4_t)] if (dtp->internal_unit[(offset + i) * sizeof (gfc_char4_t)]
!= (gfc_char4_t)' ') != (gfc_char4_t)' ')
break; break;
} }
......
...@@ -808,10 +808,10 @@ mem_read4 (stream * s, void * buf, ssize_t nbytes) ...@@ -808,10 +808,10 @@ mem_read4 (stream * s, void * buf, ssize_t nbytes)
void *p; void *p;
int nb = nbytes; int nb = nbytes;
p = mem_alloc_r (s, &nb); p = mem_alloc_r4 (s, &nb);
if (p) if (p)
{ {
memcpy (buf, p, nb); memcpy (buf, p, nb * 4);
return (ssize_t) nb; return (ssize_t) nb;
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment