This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Patch, Fortran] PR52335 - allow OPEN(..., DELIM=) with -std=f95
- From: Tobias Burnus <burnus at net-b dot de>
- To: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Wed, 22 Feb 2012 10:55:14 +0100
- Subject: [Patch, Fortran] PR52335 - allow OPEN(..., DELIM=) with -std=f95
The following patch fixes a 4.4 to 4.7 regression. Already Fortran 95
allows DELIM= in OPEN and INQUIRE. Fortran 2003 only added it to data
transfer statements (i.e. WRITE; not allowed for READ and not possible
for PRINT). Cf. F95/F2003 standard and the PR.
Build and regtested on x86-64-linux.
OK for the trunk and the 4.4 to 4.6 branches?
Tobias
PS: I am not sure how far I will back port, maybe only to 4.5.
2012-02-22 Tobias Burnus <burnus@net-b.de>
PR fortran/52335
* io.c (gfc_match_open): Remove bogus F2003 DELIM= check.
2012-02-22 Tobias Burnus <burnus@net-b.de>
PR fortran/52335
* gfortran.dg/io_constraints_10.f90: New.
Index: gcc/fortran/io.c
===================================================================
--- gcc/fortran/io.c (revision 184459)
+++ gcc/fortran/io.c (working copy)
@@ -1947,10 +1947,6 @@ gfc_match_open (void)
/* Checks on the DELIM specifier. */
if (open->delim)
{
- if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: DELIM= at %C "
- "not allowed in Fortran 95") == FAILURE)
- goto cleanup;
-
if (open->delim->expr_type == EXPR_CONSTANT)
{
static const char *delim[] = { "APOSTROPHE", "QUOTE", "NONE", NULL };
Index: gcc/testsuite/gfortran.dg/io_constraints_10.f90
===================================================================
--- gcc/testsuite/gfortran.dg/io_constraints_10.f90 (revision 0)
+++ gcc/testsuite/gfortran.dg/io_constraints_10.f90 (working copy)
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+!
+! PR fortran/52335
+!
+
+integer :: lun
+character(len=20) :: str
+
+! VALID Fortran 95:
+open(unit=lun,file=str,delim='apostrophe',status='old')
+inquire(lun, delim=str)
+
+! Fortran 2003:
+write(*,*, delim='apostrophe') 'a' ! { dg-error "Fortran 2003: DELIM= at .1. not allowed in Fortran 95" }
+end