summaryrefslogtreecommitdiff
path: root/libgfortran/m4/eoshift3.m4
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/m4/eoshift3.m4')
-rw-r--r--libgfortran/m4/eoshift3.m419
1 files changed, 19 insertions, 0 deletions
diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4
index 6cbb87cfb84..5001756df0c 100644
--- a/libgfortran/m4/eoshift3.m4
+++ b/libgfortran/m4/eoshift3.m4
@@ -91,6 +91,25 @@ eoshift3_`'atype_kind (gfc_array_char *ret, gfc_array_char *array,
which = 0;
size = GFC_DESCRIPTOR_SIZE (ret);
+ if (ret->data == NULL)
+ {
+ int i;
+
+ ret->data = internal_malloc_size (size * size0 ((array_t *)array));
+ ret->base = 0;
+ ret->dtype = array->dtype;
+ for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
+ {
+ ret->dim[i].lbound = 0;
+ ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
+
+ if (i == 0)
+ ret->dim[i].stride = 1;
+ else
+ ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
+ }
+ }
+
extent[0] = 1;
count[0] = 0;