https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85895
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P4 Status|UNCONFIRMED |NEW Last reconfirmed| |2018-05-23 CC| |kargl at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from kargl at gcc dot gnu.org --- Index: gcc/fortran/match.c =================================================================== --- gcc/fortran/match.c (revision 260623) +++ gcc/fortran/match.c (working copy) @@ -3791,6 +3791,14 @@ sync_statement (gfc_statement st) gfc_error ("Redundant ERRMSG tag found at %L", &tmp->where); goto cleanup; } + + if (tmp->ref && tmp->ref->type == REF_ARRAY) + { + gfc_error ("errmsg-variable at %L shall be a " + "scalar-default-char-variable", &tmp->where); + goto cleanup; + } + errmsg = tmp; saw_errmsg = true; This patch causes an error message to be generated. Need to go find standard language to determine if the reference of an array element counts as a scalar-default-char-variable. IOW, is the following valid Fortran program p character(80) :: c(2) sync memory (errmsg=c(2)) end