Commit 353255cd by Jerry DeLisle

re PR fortran/47778 (reading two arrays of structures from namelist fails)

2011-02-27  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: r170548
parent f6b439c9
2011-02-27 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-02-26 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> 2011-02-26 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR libfortran/45165 PR libfortran/45165
......
...@@ -2985,6 +2985,11 @@ namelist_read (st_parameter_dt *dtp) ...@@ -2985,6 +2985,11 @@ namelist_read (st_parameter_dt *dtp)
{ {
int c; int c;
char nml_err_msg[200]; 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 /* Pointer to the previously read object, in case attempt is made to read
new object name. Should this fail, error message can give previous new object name. Should this fail, error message can give previous
name. */ name. */
...@@ -3058,6 +3063,11 @@ find_nml_name: ...@@ -3058,6 +3063,11 @@ find_nml_name:
goto nml_err_ret; goto nml_err_ret;
generate_error (&dtp->common, LIBERROR_READ_VALUE, nml_err_msg); generate_error (&dtp->common, LIBERROR_READ_VALUE, nml_err_msg);
} }
/* 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;
} }
free_saved (dtp); free_saved (dtp);
......
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