]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/47778 (reading two arrays of structures from namelist fails)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Mon, 7 Mar 2011 02:06:27 +0000 (02:06 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Mon, 7 Mar 2011 02:06:27 +0000 (02:06 +0000)
2011-03-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libgfortran/47778
* io/list_read.c (namelist_read): Intialize the error string buffere.
If pprev_nl was used during the previous namelist read and the rank
was zero, reset the pointer to NULL for the next namelist read.

From-SVN: r170726

libgfortran/ChangeLog
libgfortran/io/list_read.c

index 4b2629b430397fef44188d8c9a8ac3a342fca8df..dfa19716549d015042b8e6fbaaff1521e4552c01 100644 (file)
@@ -1,3 +1,10 @@
+2011-03-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libgfortran/47778
+       * io/list_read.c (namelist_read): Intialize the error string buffere.
+       If pprev_nl was used during the previous namelist read and the rank
+       was zero, reset the pointer to NULL for the next namelist read.
+
 2011-03-04  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
index d27e372098a2044b07698ddfe8b2bf46d78aa679..36e955b3458feaf9f4a529a89e98c9669f872582 100644 (file)
@@ -2863,6 +2863,11 @@ namelist_read (st_parameter_dt *dtp)
   char c;
   jmp_buf eof_jump;
   char nml_err_msg[200];
+
+  /* Initialize the error string buffer just in case we get an unexpected fail
+     somewhere and end up at nml_err_ret.  */
+  strcpy (nml_err_msg, "Internal namelist read error");
+
   /* Pointer to the previously read object, in case attempt is made to read
      new object name.  Should this fail, error message can give previous
      name.  */
@@ -2950,7 +2955,11 @@ find_nml_name:
            }
         }
 
-   }
+     /* Reset the previous namelist pointer if we know we are not going
+       to be doing multiple reads within a single namelist object.  */
+     if (prev_nl && prev_nl->var_rank == 0)
+       prev_nl = NULL;
+    }
 
   dtp->u.p.eof_jump = NULL;
   free_saved (dtp);