diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-02-27 20:06:10 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-02-27 20:06:10 +0000 |
commit | 1bb3fe528364998a97dad45ad9f29f63eae72108 (patch) | |
tree | 2d6aff72c8dec42a2cbfc3a0201791ef12bf6b26 /libgfortran | |
parent | 776f6fe80393f609f9c83da0cc85cc240fb620b8 (diff) | |
download | gcc-1bb3fe528364998a97dad45ad9f29f63eae72108.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170548 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 7 | ||||
-rw-r--r-- | libgfortran/io/list_read.c | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index bc85a6c9e0f..800c1490bcb 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +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> PR libfortran/45165 diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 9d797cc270d..ea232327f48 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -2985,6 +2985,11 @@ namelist_read (st_parameter_dt *dtp) { int c; 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. */ @@ -3058,6 +3063,11 @@ find_nml_name: goto nml_err_ret; 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); |