+2017-10-07 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ * gfortran.h (async_io_dt): Add external reference.
+ * io.c (async_io_dt): Add variable.
+ (compare_to_allowed_values): Add prototyte. Add optional argument
+ num. If present, set it to the number of the entry that was
+ matched.
+ (check_io_constraints): If this is for an asynchronous I/O
+ statement, set async_io_dt and set the asynchronous flag for
+ a SIZE tag.
+ * resolve.c (resolve_transfer): If async_io_dt is set, set
+ the asynchronous flag on the variable.
+ (resolve_fl_namelist): If async_io_dt is set, set the asynchronous
+ flag on all elements of the namelist.
+
2017-10-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/60458
#define RESOLVE_TAG(x, y) if (!resolve_tag (x, y)) return false;
+/* Are we currently processing an asynchronous I/O statement? */
+
+bool async_io_dt;
/**************** Fortran 95 FORMAT parser *****************/
compare_to_allowed_values (const char *specifier, const char *allowed[],
const char *allowed_f2003[],
const char *allowed_gnu[], gfc_char_t *value,
- const char *statement, bool warn)
+ const char *statement, bool warn,
+ int *num = NULL);
+
+
+static int
+compare_to_allowed_values (const char *specifier, const char *allowed[],
+ const char *allowed_f2003[],
+ const char *allowed_gnu[], gfc_char_t *value,
+ const char *statement, bool warn, int *num)
{
int i;
unsigned int len;
for (i = 0; allowed[i]; i++)
if (len == strlen (allowed[i])
&& gfc_wide_strncasecmp (value, allowed[i], strlen (allowed[i])) == 0)
+ {
+ if (num)
+ *num = i;
return 1;
+ }
for (i = 0; allowed_f2003 && allowed_f2003[i]; i++)
if (len == strlen (allowed_f2003[i])
/* Check the constraints for a data transfer statement. The majority of the
constraints appearing in 9.4 of the standard appear here. Some are handled
- in resolve_tag and others in gfc_resolve_dt. */
+ in resolve_tag and others in gfc_resolve_dt. Also set the async_io_dt flag
+ and, if necessary, the asynchronous flag on the SIZE argument. */
static match
check_io_constraints (io_kind k, gfc_dt *dt, gfc_code *io_code,
if (dt->asynchronous)
{
+ int num;
static const char * asynchronous[] = { "YES", "NO", NULL };
if (!gfc_reduce_init_expr (dt->asynchronous))
if (!compare_to_allowed_values
("ASYNCHRONOUS", asynchronous, NULL, NULL,
dt->asynchronous->value.character.string,
- io_kind_name (k), warn))
+ io_kind_name (k), warn, &num))
return MATCH_ERROR;
+
+ /* Best to put this here because the yes/no info is still around. */
+ async_io_dt = num == 0;
+ if (async_io_dt && dt->size)
+ dt->size->symtree->n.sym->attr.asynchronous = 1;
}
+ else
+ async_io_dt = false;
if (dt->id)
{