This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Patch, Fortran] PR32555 re-allow zero to precede the P edit descriptor
- From: Tobias Burnus <tobias dot burnus at physik dot fu-berlin dot de>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sat, 30 Jun 2007 09:21:46 +0200
- Subject: [Patch, Fortran] PR32555 re-allow zero to precede the P edit descriptor
:ADDPATCH fortran:
My patch for rejecting the "i0" edit decriptor in READ caused a
regression in the NIST test suite by fixing format_lex() such that it
can also return FMT_ZERO.
"k P" seems to be the only place where a preceding number is allowed to
be zero (or negative).
Build (yesterday's svn version)
and regression tested (x86-64/Linux). Ok for the trunk?
Tobias
2007-06-30 Tobias Burnus <burnus@net-b.de>
PR fortran/32555
* io.c (check_format): Allow zero to precede the
P edit descriptor.
2007-06-30 Tobias Burnus <burnus@net-b.de>
PR fortran/32555
* gfortran.dg/fmt_zero_check.f90: New.
Index: gcc/fortran/io.c
===================================================================
--- gcc/fortran/io.c (revision 126139)
+++ gcc/fortran/io.c (working copy)
@@ -487,6 +487,7 @@ format_item_1:
goto format_item;
case FMT_SIGNED_INT:
+ case FMT_ZERO:
/* Signed integer can only precede a P format. */
t = format_lex ();
if (t != FMT_P)
Index: gcc/testsuite/gfortran.dg/fmt_zero_check.f90
===================================================================
--- gcc/testsuite/gfortran.dg/fmt_zero_check.f90 (revision 0)
+++ gcc/testsuite/gfortran.dg/fmt_zero_check.f90 (revision 0)
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! PR fortran/32555
+!
+2050 FORMAT(0PF9.4)
+2050 FORMAT(0F9.4) ! { dg-error "Expected P edit descriptor" }
+end