http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55978
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org |gnu.org | --- Comment #21 from janus at gcc dot gnu.org 2013-02-06 13:00:52 UTC --- (In reply to comment #18) > Btw, as an alternative: Wouldn't it be more reasonable to move the above check > into _gfortran_internal_pack? Here is the very simple patch which does this: Index: libgfortran/runtime/in_pack_generic.c =================================================================== --- libgfortran/runtime/in_pack_generic.c (revision 195800) +++ libgfortran/runtime/in_pack_generic.c (working copy) @@ -48,6 +48,9 @@ internal_pack (gfc_array_char * source) index_type size; index_type type_size; + if (source->base_addr == NULL) + return NULL; + type_size = GFC_DTYPE_TYPE_SIZE(source); size = GFC_DESCRIPTOR_SIZE (source); switch (type_size) It seems to work just as well as the patch in comment #18 and is much simpler. Also it could catch this sort of thing in other situations as well. So I would say that it is preferable over the previous patches. Will test for regressions (but don't expect any).