+2016-09-15 Louis Krupp <louis.krupp@zoho.com>
+ PR fortran/69963
+ * parse.c (reject_statement): Clear charlen pointers in implicit
+ character typespecs before those charlen structures are freed.
+
2016-09-14 Bernd Edlinger <bernd.edlinger@hotmail.de>
* simplify.c (gfc_simplify_repeat): Fix a misplaced closing ')'.
}
+/* Clear default character types with charlen pointers that are about
+ to become invalid. */
+
+static void
+clear_default_charlen (gfc_namespace *ns, const gfc_charlen *cl,
+ const gfc_charlen *end)
+{
+ gfc_typespec *ts;
+
+ for (ts = &ns->default_type[0]; ts < &ns->default_type[GFC_LETTERS]; ts++)
+ if (ts->type == BT_CHARACTER)
+ {
+ const gfc_charlen *cl2;
+ for (cl2 = cl; cl2 != end; cl2 = cl2->next)
+ if (ts->u.cl == cl2)
+ {
+ ts->u.cl = NULL;
+ ts->type = BT_UNKNOWN;
+ break;
+ }
+ }
+}
+
/* Undo anything tentative that has been built for the current
statement. */
reject_statement (void)
{
/* Revert to the previous charlen chain. */
+ clear_default_charlen (gfc_current_ns,
+ gfc_current_ns->cl_list, gfc_current_ns->old_cl_list);
gfc_free_charlen (gfc_current_ns->cl_list, gfc_current_ns->old_cl_list);
gfc_current_ns->cl_list = gfc_current_ns->old_cl_list;
+2016-09-15 Louis Krupp <louis.krupp@zoho.com>
+
+ PR fortran/69963
+ * gfortran.dg/misplaced_implicit_character.f90: New test.
+
2016-09-15 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/77503
--- /dev/null
+! { dg-do compile }
+! PR fortran/69963
+subroutine s
+ real x ! { dg-error "" }
+ implicit character (a) ! { dg-error "IMPLICIT statement at .1. cannot follow data declaration statement at .2." }
+
+ a1 = 'z' ! { dg-error "Symbol .a1. at .1. has no IMPLICIT type" }
+end subroutine s