Index: fortran/expr.c =================================================================== --- fortran/expr.c (revision 126826) +++ fortran/expr.c (working copy) @@ -1966,9 +1966,8 @@ && ap->expr->symtree->n.sym->ts.type == BT_CHARACTER && ap->expr->symtree->n.sym->ts.cl->length == NULL) { - if (gfc_notify_std (GFC_STD_GNU, "assumed character length " - "variable '%s' in constant expression at %L", - e->symtree->n.sym->name, &e->where) == FAILURE) + gfc_error ("assumed character length variable '%s' in constant " + "expression at %L", e->symtree->n.sym->name, &e->where); return MATCH_ERROR; } else if (not_restricted && check_init_expr (ap->expr) == FAILURE) @@ -2007,11 +2006,23 @@ if (strcmp (trans_func_f95[i], name) == 0) break; + /* FIXME, F2003: implement translation of initialization + expressions before enabling this check. For F95, error + out if the transformational function is not in the list. */ +#if 0 if (trans_func_f95[i] == NULL && gfc_notify_std (GFC_STD_F2003, "transformational intrinsic '%s' at %L is not permitted " "in an initialization expression", name, &e->where) == FAILURE) return MATCH_ERROR; +#else + if (trans_func_f95[i] == NULL) + { + gfc_error("transformational intrinsic '%s' at %L is not permitted " + "in an initialization expression", name, &e->where); + return MATCH_ERROR; + } +#endif return check_init_expr_arguments (e); } Index: testsuite/gfortran.dg/initialization_9.f90 =================================================================== --- testsuite/gfortran.dg/initialization_9.f90 (revision 0) +++ testsuite/gfortran.dg/initialization_9.f90 (revision 0) @@ -0,0 +1,11 @@ +! { dg-do compile } +! +! PR fortran/31639 +! Contributed by Martin Michlmayr T cyrius DOT com> + + integer function xstrcmp(s1) + character*(*), intent(in) :: s1 + integer :: n1 = len(s1) ! { dg-error "assumed character length variable" } + n1 = 1 + return + end function xstrcmp