public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Committed] PR fortran/90985 -- DATA must be followed by whitespace
@ 2019-08-02 23:51 Steve Kargl
  2019-08-05 19:02 ` H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Kargl @ 2019-08-02 23:51 UTC (permalink / raw)
  To: fortran, gcc-patches

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

In free-form source code, DATA must be followed by whitespace.
This patch checks for whitespace, and if none is found, returns
MATCH_NO to give other matchers a chance to run.

2019-08-02  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/90985
	* decl.c (gfc_match_data): In free-form code, DATA be followed by
	whitespace.

2019-08-02  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/90985
	* gfortran.dg/pr90985.f90: New test.

-- 
Steve

[-- Attachment #2: pr90985.diff --]
[-- Type: text/x-diff, Size: 1194 bytes --]

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(revision 274031)
+++ gcc/fortran/decl.c	(working copy)
@@ -621,6 +621,13 @@ gfc_match_data (void)
   gfc_expr *e;
   gfc_ref *ref;
   match m;
+  char c;
+
+  /* DATA has been matched.  In free form source code, the next character
+     needs to be whitespace.  Check that here.  */
+  c = gfc_peek_ascii_char ();
+  if (gfc_current_form == FORM_FREE && !gfc_is_whitespace (c))
+    return MATCH_NO;
 
   /* Before parsing the rest of a DATA statement, check F2008:c1206.  */
   if ((gfc_current_state () == COMP_FUNCTION
Index: gcc/testsuite/gfortran.dg/pr90985.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr90985.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr90985.f90	(working copy)
@@ -0,0 +1,14 @@
+! { dg-do compile }
+module mymod
+  type :: mytyp
+    integer :: i
+  end type mytyp
+contains
+  subroutine mysub
+    implicit none
+    type(mytyp) :: a
+    integer :: datai,dataj
+    datai = a%i
+    dataj = a%j         ! { dg-error "is not a member of the" }
+  end subroutine mysub
+end module mymod

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

* Re: [Committed] PR fortran/90985 -- DATA must be followed by whitespace
  2019-08-05 19:02 ` H.J. Lu
@ 2019-08-05 19:02   ` Steve Kargl
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Kargl @ 2019-08-05 19:02 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GNU GFortran, GCC Patches

On Mon, Aug 05, 2019 at 12:01:36PM -0700, H.J. Lu wrote:
> On Fri, Aug 2, 2019 at 4:51 PM Steve Kargl
> <sgk@troutmask.apl.washington.edu> wrote:
> >
> > In free-form source code, DATA must be followed by whitespace.
> > This patch checks for whitespace, and if none is found, returns
> > MATCH_NO to give other matchers a chance to run.
> >
> > 2019-08-02  Steven G. Kargl  <kargl@gcc.gnu.org>
> >
> >         PR fortran/90985
> >         * decl.c (gfc_match_data): In free-form code, DATA be followed by
> >         whitespace.
> >
> > 2019-08-02  Steven G. Kargl  <kargl@gcc.gnu.org>
> >
> >         PR fortran/90985
> >         * gfortran.dg/pr90985.f90: New test.
> >
> 
> This may have caused:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91372
> 

Yep.

-- 
Steve

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

* Re: [Committed] PR fortran/90985 -- DATA must be followed by whitespace
  2019-08-02 23:51 [Committed] PR fortran/90985 -- DATA must be followed by whitespace Steve Kargl
@ 2019-08-05 19:02 ` H.J. Lu
  2019-08-05 19:02   ` Steve Kargl
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2019-08-05 19:02 UTC (permalink / raw)
  To: Steve Kargl; +Cc: GNU GFortran, GCC Patches

On Fri, Aug 2, 2019 at 4:51 PM Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
>
> In free-form source code, DATA must be followed by whitespace.
> This patch checks for whitespace, and if none is found, returns
> MATCH_NO to give other matchers a chance to run.
>
> 2019-08-02  Steven G. Kargl  <kargl@gcc.gnu.org>
>
>         PR fortran/90985
>         * decl.c (gfc_match_data): In free-form code, DATA be followed by
>         whitespace.
>
> 2019-08-02  Steven G. Kargl  <kargl@gcc.gnu.org>
>
>         PR fortran/90985
>         * gfortran.dg/pr90985.f90: New test.
>

This may have caused:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91372

-- 
H.J.

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

end of thread, other threads:[~2019-08-05 19:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 23:51 [Committed] PR fortran/90985 -- DATA must be followed by whitespace Steve Kargl
2019-08-05 19:02 ` H.J. Lu
2019-08-05 19:02   ` 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).