public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH gfortran] PR 60751 - Extra comma in WRITE statement not diagnosed
@ 2016-06-10 17:05 Dominique d'Humières
  2016-06-11 18:35 ` Paul Richard Thomas
  0 siblings, 1 reply; 2+ messages in thread
From: Dominique d'Humières @ 2016-06-10 17:05 UTC (permalink / raw)
  To: fortran; +Cc: jvdelisle, gcc-patches

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH gfortran] PR 60751 - Extra comma in WRITE statement not diagnosed
  2016-06-10 17:05 [PATCH gfortran] PR 60751 - Extra comma in WRITE statement not diagnosed Dominique d'Humières
@ 2016-06-11 18:35 ` Paul Richard Thomas
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Richard Thomas @ 2016-06-11 18:35 UTC (permalink / raw)
  To: Dominique d'Humières; +Cc: fortran, jvdelisle, gcc-patches

Dear Dominique,

That looks OK to me for 5 through 7-branches.

Thanks

Paul

On 10 June 2016 at 19:05, Dominique d'Humières <dominiq@lps.ens.fr> wrote:
> 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
>



-- 
The difference between genius and stupidity is; genius has its limits.

Albert Einstein

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-11 18:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-10 17:05 [PATCH gfortran] PR 60751 - Extra comma in WRITE statement not diagnosed Dominique d'Humières
2016-06-11 18:35 ` Paul Richard Thomas

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).