I've committed the following patch. 2016-09-16 Steven G. Kargl <ka...@gcc.gnu.org>
PR fortran/77612 * decl.c (char_len_param_value): Check parent namespace for seen_implicit_none. 2016-09-16 Steven G. Kargl <ka...@gcc.gnu.org> PR fortran/77612 * gfortran.dg/pr77612.f90: New test. Index: gcc/fortran/decl.c =================================================================== --- gcc/fortran/decl.c (revision 240140) +++ gcc/fortran/decl.c (working copy) @@ -920,9 +920,10 @@ char_len_param_value (gfc_expr **expr, b t = gfc_reduce_init_expr (e); - if (!t && (e->ts.type == BT_UNKNOWN - && e->symtree->n.sym->attr.untyped == 1 - && e->symtree->n.sym->ns->seen_implicit_none == 1)) + if (!t && e->ts.type == BT_UNKNOWN + && e->symtree->n.sym->attr.untyped == 1 + && (e->symtree->n.sym->ns->seen_implicit_none == 1 + || e->symtree->n.sym->ns->parent->seen_implicit_none == 1)) { gfc_free_expr (e); goto syntax; Index: gcc/testsuite/gfortran.dg/pr77612.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr77612.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr77612.f90 (working copy) @@ -0,0 +1,13 @@ +! { dg-do compile } + +program bad_len + + implicit none + +contains + + subroutine sub + character(len = ICE) :: line ! { dg-error "INTEGER expression expected" } + end subroutine + +end program -- Steve