diff options
Diffstat (limited to 'libgfortran/intrinsics/eoshift2.c')
-rw-r--r-- | libgfortran/intrinsics/eoshift2.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/libgfortran/intrinsics/eoshift2.c b/libgfortran/intrinsics/eoshift2.c index 038588f..18c3f55 100644 --- a/libgfortran/intrinsics/eoshift2.c +++ b/libgfortran/intrinsics/eoshift2.c @@ -1,4 +1,4 @@ -/* Generic implementation of the RESHAPE intrinsic +/* Generic implementation of the EOSHIFT intrinsic Copyright 2002 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> @@ -32,7 +32,7 @@ static const char zeros[16] = sizeof(int) < sizeof (index_type). */ static void -__eoshift2 (const gfc_array_char * ret, const gfc_array_char * array, +__eoshift2 (gfc_array_char * ret, const gfc_array_char * array, int shift, const gfc_array_char * bound, int which) { /* r.* indicates the return array. */ @@ -61,6 +61,25 @@ __eoshift2 (const gfc_array_char * ret, const gfc_array_char * array, size = GFC_DESCRIPTOR_SIZE (ret); + if (ret->data == NULL) + { + int i; + + ret->data = internal_malloc (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; + } + } + which = which - 1; extent[0] = 1; @@ -186,7 +205,7 @@ __eoshift2 (const gfc_array_char * ret, const gfc_array_char * array, void -__eoshift2_4 (const gfc_array_char * ret, const gfc_array_char * array, +__eoshift2_4 (gfc_array_char * ret, const gfc_array_char * array, const GFC_INTEGER_4 * pshift, const gfc_array_char * bound, const GFC_INTEGER_4 * pdim) { @@ -195,7 +214,7 @@ __eoshift2_4 (const gfc_array_char * ret, const gfc_array_char * array, void -__eoshift2_8 (const gfc_array_char * ret, const gfc_array_char * array, +__eoshift2_8 (gfc_array_char * ret, const gfc_array_char * array, const GFC_INTEGER_8 * pshift, const gfc_array_char * bound, const GFC_INTEGER_8 * pdim) { |