public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Dominique d'Humières" <dominiq@lps.ens.fr>
To: fortran@gcc.gnu.org
Cc: "jvdelisle@charter.net" <jvdelisle@charter.net>,
	       gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH gfortran] PR 60751 - Extra comma in WRITE statement not diagnosed
Date: Fri, 10 Jun 2016 17:05:00 -0000	[thread overview]
Message-ID: <D1B97C07-DD7E-4513-A50A-728E83E8804B@lps.ens.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

The attached patch fixes pr60751 by allowing extra comma in WRITE statement for std=legacy only, tested on x86_64-apple-darwin15. Is it OK for trunk, and the gcc-5 and 6 branches?

TIA

Dominique


[-- Attachment #2: patch-60751b --]
[-- Type: application/octet-stream, Size: 4070 bytes --]

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(revision 237310)
+++ gcc/fortran/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2016-06-10  Dominique d'Humieres  <dominiq@lps.ens.fr>
+
+	PR fortran/60751
+	* io.c (gfc_resolve_dt): Replace GFC_STD_GNU with GFC_STD_LEGACY.
+
 2016-06-10  Thomas Schwinge  <thomas@codesourcery.com>
 
 	PR c/71381
Index: gcc/fortran/io.c
===================================================================
--- gcc/fortran/io.c	(revision 237310)
+++ gcc/fortran/io.c	(working copy)
@@ -3007,7 +3007,7 @@
     }
 
   if (dt->extra_comma
-      && !gfc_notify_std (GFC_STD_GNU, "Comma before i/o item list at %L", 
+      && !gfc_notify_std (GFC_STD_LEGACY, "Comma before i/o item list at %L", 
 			  &dt->extra_comma->where))
     return false;
 
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(revision 237310)
+++ gcc/testsuite/ChangeLog	(working copy)
@@ -1,3 +1,14 @@
+2016-06-10  Dominique d'Humieres  <dominiq@lps.ens.fr>
+
+	PR target/60751
+	* gfortran.dg/comma_IO_extension_1.f90: New test.
+	* gfortran.dg/comma_IO_extension_2.f90: Likewise.
+	* gfortran.dg/array_constructor_49.f90: Remove extra comma in WRITE
+	statement.
+	* gfortran.dg/graphite/pr38083.f90: Likewise.
+	* gfortran.dg/integer_exponentiation_6.F90: Likewise and add
+	missing format.
+
 2016-06-10  David Malcolm  <dmalcolm@redhat.com>
 
 	* gcc.dg/plugin/must-tail-call-2.c: Remove all details from
Index: gcc/testsuite/gfortran.dg/array_constructor_49.f90
===================================================================
--- gcc/testsuite/gfortran.dg/array_constructor_49.f90	(revision 237310)
+++ gcc/testsuite/gfortran.dg/array_constructor_49.f90	(working copy)
@@ -6,7 +6,7 @@
 program t
   integer :: ndim=2, ndfp=4, i
   character (len=8) :: line
-  write (unit=line,fmt='(4I2)'), (/ ( i, i = 1, ndfp ) /) + ndim
+  write (unit=line,fmt='(4I2)') (/ ( i, i = 1, ndfp ) /) + ndim
   if (line /= ' 3 4 5 6') call abort
 end program t
 ! { dg-final { scan-tree-dump-times "__var" 3 "original" } }
Index: gcc/testsuite/gfortran.dg/comma_IO_extension_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/comma_IO_extension_1.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/comma_IO_extension_1.f90	(working copy)
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR 60751
+! Contributed by Walter Spector <w6ws@earthlink.net>
+program extracomma
+  implicit none
+
+  write (*,*), 1, 2, 3 ! { dg-warning "Legacy Extension: Comma before i/o item list" }
+end program
Index: gcc/testsuite/gfortran.dg/comma_IO_extension_2.f90
===================================================================
--- gcc/testsuite/gfortran.dg/comma_IO_extension_2.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/comma_IO_extension_2.f90	(working copy)
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "-std=legacy" }
+! PR 60751
+! Contributed by Walter Spector <w6ws@earthlink.net>
+program extracomma
+  implicit none
+
+  write (*,*), 1, 2, 3
+end program
Index: gcc/testsuite/gfortran.dg/graphite/pr38083.f90
===================================================================
--- gcc/testsuite/gfortran.dg/graphite/pr38083.f90	(revision 237310)
+++ gcc/testsuite/gfortran.dg/graphite/pr38083.f90	(working copy)
@@ -8,7 +8,7 @@
 10 IF (IL .GE. IH) GO TO 80
 20 NSEGS = (IH + IL) / 2
   IF (NSEGS .GT. MAXSGS) THEN
-     WRITE (IOUNIT),MAXSGS
+     WRITE (IOUNIT) MAXSGS
   ENDIF
 80 NSEGS = NSEGS - 1
 90 IF (IH - IL .GE. 11) GO TO 20
Index: gcc/testsuite/gfortran.dg/integer_exponentiation_6.F90
===================================================================
--- gcc/testsuite/gfortran.dg/integer_exponentiation_6.F90	(revision 237310)
+++ gcc/testsuite/gfortran.dg/integer_exponentiation_6.F90	(working copy)
@@ -1,4 +1,4 @@
 ! { dg-options "-fno-range-check" }
 program test
-  write (*), (2_8 ** 64009999_8) / 2
+  write (*,*) (2_8 ** 64009999_8) / 2
 end program test

             reply	other threads:[~2016-06-10 17:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 17:05 Dominique d'Humières [this message]
2016-06-11 18:35 ` Paul Richard Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D1B97C07-DD7E-4513-A50A-728E83E8804B@lps.ens.fr \
    --to=dominiq@lps.ens.fr \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jvdelisle@charter.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).