aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2018-12-10 18:05:37 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2018-12-10 18:05:37 +0000
commita84162511d4712374a9ae76edae32a5068fcfc0d (patch)
tree034a8398ee5599c374c104325d351c6f3459eb58 /gcc
parent98900a06642a7c10751720a26f8cbca359d89fa3 (diff)
downloadgcc-a84162511d4712374a9ae76edae32a5068fcfc0d.zip
gcc-a84162511d4712374a9ae76edae32a5068fcfc0d.tar.gz
gcc-a84162511d4712374a9ae76edae32a5068fcfc0d.tar.bz2
re PR fortran/88269 (ICE in gfc_format_decoder, at fortran/error.c:947)
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: r266959
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/io.c16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr88269.f906
4 files changed, 30 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 031a988..bbb8ce1 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index 8008f92..8d54107 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -3678,10 +3678,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;\
}
@@ -3741,11 +3744,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);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index babcb6c..35b4fe1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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-10 Uros Bizjak <ubizjak@gmail.com>
PR target/88418
diff --git a/gcc/testsuite/gfortran.dg/pr88269.f90 b/gcc/testsuite/gfortran.dg/pr88269.f90
new file mode 100644
index 0000000..6cda5f7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr88269.f90
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! PR fortran/88269
+program p
+ write (end=1e1) ! { dg-error "tag not allowed" }
+end
+