Index: gcc/fortran/trans-decl.c =================================================================== *** gcc/fortran/trans-decl.c (revision 265231) --- gcc/fortran/trans-decl.c (working copy) *************** gfc_get_symbol_decl (gfc_symbol * sym) *** 1762,1768 **** gfc_finish_var_decl (length, sym); if (!sym->attr.associate_var && TREE_CODE (length) == VAR_DECL ! && sym->value && sym->value->ts.u.cl->length) { gfc_expr *len = sym->value->ts.u.cl->length; DECL_INITIAL (length) = gfc_conv_initializer (len, &len->ts, --- 1762,1769 ---- gfc_finish_var_decl (length, sym); if (!sym->attr.associate_var && TREE_CODE (length) == VAR_DECL ! && sym->value && sym->value->expr_type != EXPR_NULL ! && sym->value->ts.u.cl->length) { gfc_expr *len = sym->value->ts.u.cl->length; DECL_INITIAL (length) = gfc_conv_initializer (len, &len->ts, *************** gfc_get_symbol_decl (gfc_symbol * sym) *** 1772,1778 **** DECL_INITIAL (length)); } else ! gcc_assert (!sym->value); } gfc_finish_var_decl (decl, sym); --- 1773,1779 ---- DECL_INITIAL (length)); } else ! gcc_assert (!sym->value || sym->value->expr_type == EXPR_NULL); } gfc_finish_var_decl (decl, sym); Index: gcc/testsuite/gfortran.dg/deferred_character_30.f90 =================================================================== *** gcc/testsuite/gfortran.dg/deferred_character_30.f90 (nonexistent) --- gcc/testsuite/gfortran.dg/deferred_character_30.f90 (working copy) *************** *** 0 **** --- 1,9 ---- + ! { dg-do compile } + ! + ! Fix a regression introduced by the patch for PR70149. + ! + character (:), pointer :: ptr => NULL() ! The NULL () caused an ICE. + character (6), target :: tgt = 'lmnopq' + ptr => tgt + print *, len (ptr), ptr + end