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]

[PATCH] Fix-up for PR fortran/66724 and fortran/66725


The attached patch is needed to fully address PR fortran/66724 and
fortran/66725.  In is_char_type(), we need to call gfc_resolve_expr
to properly resolve the tag, e.g., ASYNCHRONOUS="Y"//"E"//"S".
At the same time, I forgot call is_char_type for ASYNCHRONOUS.
Regression tested on trunk.  OK to commit?

2015-07-16  Steven G. Kargl  <kargl@gcc.gnu.org>

	* io.c (is_char_type): Call gfc_resolve_expr().
	(match_open_element, match_dt_element, match_inquire_element): Fix
	ASYNCHRONOUS case.

-- 
Steve
Index: gcc/fortran/io.c
===================================================================
--- gcc/fortran/io.c	(revision 225843)
+++ gcc/fortran/io.c	(working copy)
@@ -1260,6 +1260,8 @@ check_char_variable (gfc_expr *e)
 static bool
 is_char_type (const char *name, gfc_expr *e)
 {
+  gfc_resolve_expr (e);
+
   if (e->ts.type != BT_CHARACTER)
     {
       gfc_error ("%s requires a scalar-default-char-expr at %L",
@@ -1580,6 +1582,8 @@ match_open_element (gfc_open *open)
   match m;
 
   m = match_etag (&tag_e_async, &open->asynchronous);
+  if (m == MATCH_YES && !is_char_type ("ASYNCHRONOUS", open->asynchronous))
+    return MATCH_ERROR;
   if (m != MATCH_NO)
     return m;
   m = match_etag (&tag_unit, &open->unit);
@@ -2752,6 +2756,8 @@ match_dt_element (io_kind k, gfc_dt *dt)
     }
 
   m = match_etag (&tag_e_async, &dt->asynchronous);
+  if (m == MATCH_YES && !is_char_type ("ASYNCHRONOUS", dt->asynchronous))
+    return MATCH_ERROR;
   if (m != MATCH_NO)
     return m;
   m = match_etag (&tag_e_blank, &dt->blank);
@@ -3986,6 +3992,8 @@ match_inquire_element (gfc_inquire *inqu
   RETM m = match_vtag (&tag_write, &inquire->write);
   RETM m = match_vtag (&tag_readwrite, &inquire->readwrite);
   RETM m = match_vtag (&tag_s_async, &inquire->asynchronous);
+  if (m == MATCH_YES && !is_char_type ("ASYNCHRONOUS", inquire->asynchronous))
+    return MATCH_ERROR;
   RETM m = match_vtag (&tag_s_delim, &inquire->delim);
   RETM m = match_vtag (&tag_s_decimal, &inquire->decimal);
   RETM m = match_out_tag (&tag_size, &inquire->size);

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