Package info files correctly
[platform/upstream/gcc48.git] / libgfortran / runtime / in_pack_generic.c
index 64ae662..330f0f4 100644 (file)
@@ -1,9 +1,8 @@
 /* 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
@@ -49,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)
@@ -124,26 +126,26 @@ internal_pack (gfc_array_char * source)
 #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);
@@ -175,12 +177,12 @@ internal_pack (gfc_array_char * 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)