diff mbox series

[fortran] PR52564 Accepts invalid: Missing I/O list after comma

Message ID 12de47dd-d8c7-bef3-573b-814a34222417@charter.net
State New
Headers show
Series [fortran] PR52564 Accepts invalid: Missing I/O list after comma | expand

Commit Message

Jerry DeLisle Jan. 31, 2019, 1:29 a.m. UTC
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.

Comments

Steve Kargl Jan. 31, 2019, 2:02 a.m. UTC | #1
On Wed, Jan 30, 2019 at 05:29:52PM -0800, Jerry DeLisle wrote:
> The attached patch is straight-forward and self explanatory.
> 
> Regression tested on x86-64-pc-linux-gnu.  Test case attached.
> 
> OK for trunk?
> 

Yes.  Thanks for patch.
diff mbox series

Patch

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)