Hi all,

The attached patch fixes this regression and retains the desired behavior for
PR46800. We don't have a test case for PR46800 since it involves user input at a
terminal. (It would be good to get such a test case of course)

This patch has been regression tested with 4.9 and 4.10 on x86-64 linux.

OK for trunk and then 4.9?  Test case from PR.

Regards,

Jerry

2014-05-04  Jerry DeLisle  <jvdeli...@gcc.gnu>

        PR libfortran/61049
        * io/list_read.c (list_formatted_read_scalar): Use eat_separator
        and delete extraneous code.

Index: list_read.c
===================================================================
--- list_read.c	(revision 210049)
+++ list_read.c	(working copy)
@@ -2054,21 +2078,10 @@ list_formatted_read_scalar (st_parameter_dt *dtp,
 	}
       if (is_separator (c))
 	{
-	  /* Found a null value. Do not use eat_separator here otherwise
-	     we will do an extra read from stdin.  */
+	  /* Found a null value.  */
 	  dtp->u.p.repeat_count = 0;
+	  eat_separator (dtp);
 
-	  /* Set comma_flag.  */
-	  if ((c == ';' 
-	      && dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
-	      ||
-	      (c == ','
-	      && dtp->u.p.current_unit->decimal_status == DECIMAL_POINT))
-	    {
-	      dtp->u.p.comma_flag = 1;
-	      goto cleanup;
-	    }
-
 	  /* Set end-of-line flag.  */
 	  if (c == '\n' || c == '\r')
 	    {
@@ -2082,7 +2095,6 @@ list_formatted_read_scalar (st_parameter_dt *dtp,
 	  else
 	    goto cleanup;
 	}
-
     }
   else
     {
c { dg-do run }
c PR61049, reduced test case by  Dominique d'Humieres
      character(len=30) :: buff = ", (2.0, 3.0),,6.0D0, 2*,"
      DOUBLE PRECISION AVD, BVD, CVD, DVCORR 
      COMPLEX AVC, BVC, CVC, ZVCORR
      
      read(buff, *, err=10)  AVD, AVC, BVC, BVD, CVC, CVD
      goto 20
 10   call abort
 20   continue       
      end
    
  

Reply via email to