This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch,libgfortran] PR25419 gfortran read does not take comma for default
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 25 Dec 2005 23:08:47 -0800
- Subject: [patch,libgfortran] PR25419 gfortran read does not take comma for default
:ADDPATCH fortran:
The below patch is "simple and obvious" (obvious being a relative term) I will
commit along with attached test case in ~24 hours unless I am notified
otherwise. Behavior with this patch matches g77 and ifort.
NOTE: The patch may have an offset since I have another patch pending in
list_read.c
Regards,
Jerry
Regression tested and NIST tested on i686-pc-linux-gnu.
2005-12-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/25419
* io/list_read.c (list_formatted_read_scalar): Allow comma to return a
null value (default).
Index: io/list_read.c
===================================================================
*** io/list_read.c (revision 109050)
--- io/list_read.c (working copy)
*************** list_formatted_read_scalar (st_parameter
*** 1353,1362 ****
{ /* Found a null value. */
eat_separator (dtp);
dtp->u.p.repeat_count = 0;
! if (dtp->u.p.at_eol)
! finish_separator (dtp);
! else
! goto cleanup;
}
}
--- 1353,1359 ----
{ /* Found a null value. */
eat_separator (dtp);
dtp->u.p.repeat_count = 0;
! goto cleanup;
}
}
! { dg-do run }
! PR25419 Default input with commas.
! Derived from example given in PR.
! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
stuff = 1
stuff2 = 2
write(11,'(a)') ",,"
rewind(11)
read(11,*)stuff, stuff2
if (stuff.ne.1.0) call abort()
if (stuff2.ne.2.0) call abort()
rewind (11)
write(11,'(a)') ","
rewind(11)
read(11,*)stuff
if (stuff.ne.1.0) call abort()
end