This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, fortran] PR52564 Accepts invalid: Missing I/O list after comma
- From: Jerry DeLisle <jvdelisle at charter dot net>
- To: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 30 Jan 2019 17:29:52 -0800
- Subject: [patch, fortran] PR52564 Accepts invalid: Missing I/O list after comma
The attached patch is straight-forward and self explanatory.
Regression tested on x86-64-pc-linux-gnu. Test case attached.
OK for trunk?
2019-01-31 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/52564
* io.c (match_io): Add check for comma after '*' without subsequent
IO list.
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index fce9228c302..95b30132203 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)
! { 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