This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran,patch] PR fortran/20842


That's one part of the front-end I understand enough to patch! ;-)

Trivial patch attached fixes PR fortran/20842: we cannot have a WRITE statement using an END tage. This patch is very simple (and, if I dare say, foolproof).

Regtested on i386-linux, comes with nice testcase, half-price and one year warranty. Does someone buy it?

FX
! { dg-do compile }
! PR fortran/20842
WRITE(UNIT=6,END=999) 0 ! { dg-error "END tag .* is not compatible with output" }
999 CONTINUE
END
Index: gcc/fortran/io.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/io.c,v
retrieving revision 1.25
diff -u -3 -p -r1.25 io.c
--- gcc/fortran/io.c    1 Jun 2005 03:44:34 -0000       1.25
+++ gcc/fortran/io.c    18 Jun 2005 20:59:53 -0000
@@ -1643,7 +1643,14 @@ match_dt_element (io_kind k, gfc_dt * dt
 
   m = match_ltag (&tag_end, &dt->end);
   if (m == MATCH_YES)
-    dt->end_where = gfc_current_locus;
+    {
+      if (k == M_WRITE)
+       {
+         gfc_error ("END tag at %C is not compatible with output");
+         return MATCH_ERROR;
+       }
+      dt->end_where = gfc_current_locus;
+    }
   if (m != MATCH_NO)
     return m;
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]