Hi all,
This patch is trivial, though not obvious.
The error occurred when the current name list object, nl, was set back
to first_nl with this test case. The current object was at the end of
the linked list of objects so there are no further objects to match
and read. Checking for NULL catches this.
This changes two test cases as well. The output error messages for
those cases, 40 and 47, is adjusted. Honestly, I always thought that
error message was odd before because it included only the name of the
first_nl. I just did not "see" it until now.
Regression tested on x86_64-unknown-linux-gnu. OK for trunk? I think
we should also backport to 4.4. [aside: I see at least some major
distributions now have moved to 4.4, so there may be less value going
to 4.3, but it is an easy patch]
Regards,
Jerry
2009-08-01 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/40853
* io/list_read.c (nml_get_obj_data): Do not set nl
pointer to first_nl if nl->next is NULL.
Index: list_read.c
===================================================================
--- list_read.c (revision 150323)
+++ list_read.c (working copy)
@@ -2773,7 +2773,7 @@
if (nl->type == GFC_DTYPE_DERIVED)
nml_touch_nodes (nl);
- if (component_flag && nl->var_rank > 0)
+ if (component_flag && nl->var_rank > 0 && nl->next)
nl = first_nl;
/* Make sure no extraneous qualifiers are there. */