From 1a6872a2eb088bdfe9839f8ece776da8029fe078 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Fri, 17 Jul 2015 00:05:02 +0000 Subject: [PATCH] re PR fortran/66724 (ICE on input/output statements with wrong specifier data) 2015-07-16 Steven G. Kargl PR fortran/66724 PR fortran/66724 * io.c (is_char_type): Call gfc_resolve_expr (). (match_open_element, match_dt_element, match_inquire_element): Fix ASYNCHRONOUS case. From-SVN: r225913 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/io.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4822a65c2b8..a3fd6debb3b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2015-07-16 Steven G. Kargl + + PR fortran/66724 + PR fortran/66724 + * io.c (is_char_type): Call gfc_resolve_expr (). + (match_open_element, match_dt_element, match_inquire_element): Fix + ASYNCHRONOUS case. + 2015-07-15 Andrew MacLeod * trans-types.c: Remove multiline #include comment. diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index d50a45a5956..436c09a1dee 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -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 *inquire) 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); -- 2.30.2