public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran] PR52564 Accepts invalid: Missing I/O list after comma
@ 2019-01-31  1:37 Jerry DeLisle
  2019-01-31  7:40 ` Steve Kargl
  0 siblings, 1 reply; 2+ messages in thread
From: Jerry DeLisle @ 2019-01-31  1:37 UTC (permalink / raw)
  To: fortran; +Cc: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

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.


[-- Attachment #2: pr52564.diff --]
[-- Type: text/x-patch, Size: 704 bytes --]

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)

[-- Attachment #3: print_2.f90 --]
[-- Type: text/x-fortran, Size: 213 bytes --]

! { 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch, fortran] PR52564 Accepts invalid: Missing I/O list after comma
  2019-01-31  1:37 [patch, fortran] PR52564 Accepts invalid: Missing I/O list after comma Jerry DeLisle
@ 2019-01-31  7:40 ` Steve Kargl
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Kargl @ 2019-01-31  7:40 UTC (permalink / raw)
  To: Jerry DeLisle; +Cc: fortran, GCC Patches

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.

-- 
Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-31  2:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-31  1:37 [patch, fortran] PR52564 Accepts invalid: Missing I/O list after comma Jerry DeLisle
2019-01-31  7:40 ` Steve Kargl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).