aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2019-01-31 03:37:16 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2019-01-31 03:37:16 +0000
commit474175e925a90166e1f4adcc83f9ddfbab1f841b (patch)
treee10c552e4cb0b02f4e9b384e86ec361ca06ce01b
parentf7478e4e33252da20e97138c7f1503e7706f300b (diff)
downloadgcc-474175e925a90166e1f4adcc83f9ddfbab1f841b.zip
gcc-474175e925a90166e1f4adcc83f9ddfbab1f841b.tar.gz
gcc-474175e925a90166e1f4adcc83f9ddfbab1f841b.tar.bz2
re PR fortran/52564 (Accepts invalid: Missing I/O list after comma)
2019-01-30 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/52564 * io.c (match_io): Add check for comma after '*' without subsequent IO list. * gfortran.dg/print_2.f90: New test. From-SVN: r268412
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/io.c17
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/print_2.f907
4 files changed, 35 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ac9169a..c78e32a 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2019-01-30 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/52564
+ * io.c (match_io): Add check for comma after '*' without subsequent
+ IO list.
+
2019-01-30 Dominique d'Humieres <dominiq@gcc.gnu.org>
PR fortran/52884
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index fce9228..95b3013 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -4172,6 +4172,23 @@ match_io (io_kind k)
else
gfc_current_locus = where;
}
+
+ if (gfc_match_char ('*') == MATCH_YES
+ && gfc_match_char(',') == MATCH_YES)
+ {
+ locus where2 = gfc_current_locus;
+ if (gfc_match_eos () == MATCH_YES)
+ {
+ gfc_current_locus = where2;
+ gfc_error ("Comma after * at %C not allowed without I/O list");
+ m = MATCH_ERROR;
+ goto cleanup;
+ }
+ else
+ gfc_current_locus = where;
+ }
+ else
+ gfc_current_locus = where;
}
if (gfc_current_form == FORM_FREE)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d14df18..917c13e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-30 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/52564
+ * gfortran.dg/print_2.f90: New test.
+
2019-01-30 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/87246
diff --git a/gcc/testsuite/gfortran.dg/print_2.f90 b/gcc/testsuite/gfortran.dg/print_2.f90
new file mode 100644
index 0000000..4befedf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/print_2.f90
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR52564 Accepts invalid: Missing I/O list after comma
+program printbug
+ print *, 'hello world'
+! the following line should not compile:
+ print *, ! { dg-error "not allowed" }
+end program