This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Committed] PR fortran/91372 -- Fix parsing of DATA with implied do-loop


I've committed the attached patch as obvious.  My previous
patch was too strict (and incorrect) in the interpretation
of 

R837 data-stmt  is DATA data-stmt-set [ [ , ] data-stmt-set ] ...

The previous patch required whitespace after DATA, but it seems
that it id valid to do 'DATA(x(i),i=1,2)/1.,2./' where the implied
do-loop nestles up against DATA.

2019-08-05  Steven g. Kargl  <kargl@gcc.gnu.org>

	PR fortran/91372
	* decl.c (gfc_match_data): Allow an implied do-loop to nestle against
	DATA.

2019-08-05  Steven g. Kargl  <kargl@gcc.gnu.org>

	PR fortran/91372
	* gfortran.dg/pr91372.f90: New test.

-- 
Steve
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(revision 274119)
+++ gcc/fortran/decl.c	(working copy)
@@ -624,9 +624,10 @@ gfc_match_data (void)
   char c;
 
   /* DATA has been matched.  In free form source code, the next character
-     needs to be whitespace.  Check that here.  */
+     needs to be whitespace or '(' from an implied do-loop.  Check that
+     here.  */
   c = gfc_peek_ascii_char ();
-  if (gfc_current_form == FORM_FREE && !gfc_is_whitespace (c))
+  if (gfc_current_form == FORM_FREE && !gfc_is_whitespace (c) && c != '(')
     return MATCH_NO;
 
   /* Before parsing the rest of a DATA statement, check F2008:c1206.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]