Hi all,
The attached patch fixes this bug by resetting the pprev_nl pointer to NULL when
the rank of the previous object read was zero. pprev_nl is used to track
multiple reads from the same namelist variable.
Regression tested on x86-64.
OK for trunk? I suggest we should back port to 4.5 and possibly earlier.
Regards,
Jerry
2011-02-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/47778
* io/list_read.c (namelist_read): 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.
Index: io/list_read.c
===================================================================
--- io/list_read.c (revision 170543)
+++ io/list_read.c (working copy)
@@ -3058,6 +3058,8 @@
goto nml_err_ret;
generate_error (&dtp->common, LIBERROR_READ_VALUE, nml_err_msg);
}
+ if (prev_nl && prev_nl->var_rank == 0)
+ prev_nl = NULL;
}
free_saved (dtp);