https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95612
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #2 from kargl at gcc dot gnu.org --- Index: gcc/fortran/expr.c =================================================================== --- gcc/fortran/expr.c (revision 280157) +++ gcc/fortran/expr.c (working copy) @@ -4256,7 +4262,20 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr * gfc_symbol *sym; bool target; - gcc_assert (rvalue->symtree); + if (gfc_is_size_zero_array (rvalue)) + { + gfc_error ("Zero-sized array detected at %L where an entity with " + "the TARGET attribute is expected", &rvalue->where); + return false; + } + else if (!rvalue->symtree) + { + gfc_error ("Pointer assignment target in initialization expression " + "does not have the TARGET attribute at %L", + &rvalue->where); + return false; + } + sym = rvalue->symtree->n.sym; if (sym->ts.type == BT_CLASS && sym->attr.class_ok)