]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/88269 (ICE in gfc_format_decoder, at fortran/error.c:947)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 10 Dec 2018 20:03:32 +0000 (20:03 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 10 Dec 2018 20:03:32 +0000 (20:03 +0000)
2018-12-10  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/88269
* io.c (io_constraint): Update macro. If locus line buffer is NULL,
use gfc_current_locus in error messages.
(check_io_constraints): Catch missing IO UNIT in write and read
statements.  io_constraint macro is incompatible here.

2018-12-10  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/88269
* gfortran.dg/pr88269.f90: New test.

From-SVN: r266962

gcc/fortran/ChangeLog
gcc/fortran/io.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr88269.f90 [new file with mode: 0644]

index 17832687e642c7bbeefebc4e86461cc28e4562c9..cba5c430e224af165cbd7dec0aee5b6cc949c04d 100644 (file)
@@ -1,3 +1,11 @@
+2018-12-10  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/88269
+       * io.c (io_constraint): Update macro. If locus line buffer is NULL,
+       use gfc_current_locus in error messages.
+       (check_io_constraints): Catch missing IO UNIT in write and read
+       statements.  io_constraint macro is incompatible here.
+
 2018-12-09  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/88205
index 8fd47c40fd1cf15960127ce49d8349be640c56f6..6bb2faa74fe94fa113276dd93891e21d9b3d1cc8 100644 (file)
@@ -3617,10 +3617,13 @@ static match
 check_io_constraints (io_kind k, gfc_dt *dt, gfc_code *io_code,
                      locus *spec_end)
 {
-#define io_constraint(condition,msg,arg)\
+#define io_constraint(condition, msg, arg)\
 if (condition) \
   {\
-    gfc_error(msg,arg);\
+    if ((arg)->lb != NULL)\
+      gfc_error ((msg), (arg));\
+    else\
+      gfc_error ((msg), &gfc_current_locus);\
     m = MATCH_ERROR;\
   }
 
@@ -3680,11 +3683,14 @@ if (condition) \
   if (expr && expr->ts.type != BT_CHARACTER)
     {
 
-      io_constraint (gfc_pure (NULL) && (k == M_READ || k == M_WRITE),
-                    "IO UNIT in %s statement at %C must be "
+      if (gfc_pure (NULL) && (k == M_READ || k == M_WRITE))
+       {
+         gfc_error ("IO UNIT in %s statement at %C must be "
                     "an internal file in a PURE procedure",
                     io_kind_name (k));
-
+         return MATCH_ERROR;
+       }
+         
       if (k == M_READ || k == M_WRITE)
        gfc_unset_implicit_pure (NULL);
     }
index f1159c7ed98d2cbc3544bf4fad3f594022b4ee8c..ee66741534379188a6f5586a0c1211c7e8d80d3e 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-10  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/88269
+       * gfortran.dg/pr88269.f90: New test.
+
 2018-12-09  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/88205
diff --git a/gcc/testsuite/gfortran.dg/pr88269.f90 b/gcc/testsuite/gfortran.dg/pr88269.f90
new file mode 100644 (file)
index 0000000..6cda5f7
--- /dev/null
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! PR fortran/88269
+program p
+   write (end=1e1) ! { dg-error "tag not allowed" }
+end
+