]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libfortran/61640 (KIND=4 Character Array Internal Unit Read Fail)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 29 Jun 2014 02:49:45 +0000 (02:49 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 29 Jun 2014 02:49:45 +0000 (02:49 +0000)
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

libgfortran/ChangeLog
libgfortran/io/list_read.c
libgfortran/io/unix.c

index c4e9949c9d7b773f00af23fe74b946ac3e1e713a..10761e1c57c767e3abb72955fc11e4596f18bf15 100644 (file)
@@ -1,3 +1,11 @@
+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>
 
        PR fortran/29383
index 96db0594b9046c59358aa1164e45004a86a4a47e..1cb329f7df41bee13fc35d5ee0429280b51be443 100644 (file)
@@ -273,7 +273,7 @@ next_char_internal (st_parameter_dt *dtp)
   /* Get the next character and handle end-of-record conditions.  */
 
   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
    {
      char cc;
@@ -399,7 +399,7 @@ eat_spaces (st_parameter_dt *dtp)
        {
          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)' ')
                break;
            }
index c9866d3495a6092e07e7f5aba62ac2cdf0510073..9ad293b60a462e85af3f9e053e28a276f90aed39 100644 (file)
@@ -808,10 +808,10 @@ mem_read4 (stream * s, void * buf, ssize_t nbytes)
   void *p;
   int nb = nbytes;
 
-  p = mem_alloc_r (s, &nb);
+  p = mem_alloc_r4 (s, &nb);
   if (p)
     {
-      memcpy (buf, p, nb);
+      memcpy (buf, p, nb * 4);
       return (ssize_t) nb;
     }
   else