/* Generic helper function for repacking arrays.
- Copyright (C) 2003-2013 Free Software Foundation, Inc.
+ Copyright (C) 2003-2018 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran runtime library (libgfortran).
<http://www.gnu.org/licenses/>. */
#include "libgfortran.h"
-#include <stdlib.h>
-#include <assert.h>
#include <string.h>
extern void *internal_pack (gfc_array_char *);
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)
return source->base_addr;
/* Allocate storage for the destination. */
- destptr = xmalloc (ssize * size);
+ destptr = xmallocarray (ssize, size);
dest = (char *)destptr;
src = source->base_addr;
stride0 = stride[0] * size;