diff mbox

[libgfortran] PR 46010 - I/O: Namelist-reading bug

Message ID 1018541892.462121.1288054139763.JavaMail.root@cl02-host02.dlls.pa.frontiernet.net
State New
Headers show

Commit Message

Jerry DeLisle Oct. 26, 2010, 12:48 a.m. UTC
Hi all,

The attached patch is simple and fairly safe.  It adds a couple of conditions to assure that nml_parse_qualifier sets the end index for the loop spec.  I will add the two test cases in the PR to our testsuite.

Regression tested on x86-64.  OK for trunk?

Jerry

2010-10-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

    PR libgfortran/46010
    * io/list_read.c (nml_parse_qualifier): Add additional conditions for
    setting the end index for loop specification. Fix some whitespace.
diff mbox

Patch

Index: list_read.c
===================================================================
--- list_read.c	(revision 165900)
+++ list_read.c	(working copy)
@@ -2105,8 +2105,10 @@  nml_parse_qualifier (st_parameter_dt *dtp, descrip
 
 		  /*  If -std=f95/2003 or an array section is specified,
 		      do not allow excess data to be processed.  */
-                  if (is_array_section == 1
-		      || !(compile_options.allow_std & GFC_STD_GNU))
+		  if (is_array_section == 1
+		      || !(compile_options.allow_std & GFC_STD_GNU)
+		      || !dtp->u.p.ionml->touched
+		      || dtp->u.p.ionml->type == BT_DERIVED)
 		    ls[dim].end = ls[dim].start;
 		  else
 		    dtp->u.p.expanded_read = 1;
@@ -2121,12 +2123,12 @@  nml_parse_qualifier (st_parameter_dt *dtp, descrip
 	}
 
       if (is_array_section == 1 && dtp->u.p.expanded_read == 1)
-     	{
+	{
 	  int i;
 	  dtp->u.p.expanded_read = 0;
 	  for (i = 0; i < dim; i++)
 	    ls[i].end = ls[i].start;
-      	}
+	}
 
       /* Check the values of the triplet indices.  */
       if ((ls[dim].start > (ssize_t) GFC_DIMENSION_UBOUND(ad[dim]))