/* Generic helper function for repacking arrays.
- Copyright 2003, 2004, 2005, 2007, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright (C) 2003-2013 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
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)
#endif
case GFC_DTYPE_DERIVED_2:
- if (GFC_UNALIGNED_2(source->data))
+ if (GFC_UNALIGNED_2(source->base_addr))
break;
else
return internal_pack_2 ((gfc_array_i2 *) source);
case GFC_DTYPE_DERIVED_4:
- if (GFC_UNALIGNED_4(source->data))
+ if (GFC_UNALIGNED_4(source->base_addr))
break;
else
return internal_pack_4 ((gfc_array_i4 *) source);
case GFC_DTYPE_DERIVED_8:
- if (GFC_UNALIGNED_8(source->data))
+ if (GFC_UNALIGNED_8(source->base_addr))
break;
else
return internal_pack_8 ((gfc_array_i8 *) source);
#ifdef HAVE_GFC_INTEGER_16
case GFC_DTYPE_DERIVED_16:
- if (GFC_UNALIGNED_16(source->data))
+ if (GFC_UNALIGNED_16(source->base_addr))
break;
else
return internal_pack_16 ((gfc_array_i16 *) source);
}
if (packed)
- return source->data;
+ return source->base_addr;
/* Allocate storage for the destination. */
- destptr = internal_malloc_size (ssize * size);
+ destptr = xmalloc (ssize * size);
dest = (char *)destptr;
- src = source->data;
+ src = source->base_addr;
stride0 = stride[0] * size;
while (src)