diff options
Diffstat (limited to 'libgfortran/generated/minloc1_4_i8.c')
-rw-r--r-- | libgfortran/generated/minloc1_4_i8.c | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/libgfortran/generated/minloc1_4_i8.c b/libgfortran/generated/minloc1_4_i8.c index c9dad8039db..358b4fa88b4 100644 --- a/libgfortran/generated/minloc1_4_i8.c +++ b/libgfortran/generated/minloc1_4_i8.c @@ -57,11 +57,8 @@ minloc1_4_i8 (gfc_array_i4 *retarray, gfc_array_i8 *array, index_type *pdim) /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - assert (rank == GFC_DESCRIPTOR_RANK (retarray)); if (array->dim[0].stride == 0) array->dim[0].stride = 1; - if (retarray->dim[0].stride == 0) - retarray->dim[0].stride = 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; delta = array->dim[dim].stride; @@ -95,8 +92,17 @@ minloc1_4_i8 (gfc_array_i4 *retarray, gfc_array_i8 *array, index_type *pdim) * retarray->dim[rank-1].stride * extent[rank-1]); retarray->base = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; } - + else + { + if (retarray->dim[0].stride == 0) + retarray->dim[0].stride = 1; + + if (rank != GFC_DESCRIPTOR_RANK (retarray)) + runtime_error ("rank of return array incorrect"); + } + for (n = 0; n < rank; n++) { count[n] = 0; @@ -191,11 +197,8 @@ mminloc1_4_i8 (gfc_array_i4 * retarray, gfc_array_i8 * array, dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; - assert (rank == GFC_DESCRIPTOR_RANK (retarray)); if (array->dim[0].stride == 0) array->dim[0].stride = 1; - if (retarray->dim[0].stride == 0) - retarray->dim[0].stride = 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; if (len <= 0) @@ -217,6 +220,34 @@ mminloc1_4_i8 (gfc_array_i4 * retarray, gfc_array_i8 * array, array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; } + if (retarray->data == NULL) + { + for (n = 0; n < rank; n++) + { + retarray->dim[n].lbound = 0; + retarray->dim[n].ubound = extent[n]-1; + if (n == 0) + retarray->dim[n].stride = 1; + else + retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; + } + + retarray->data + = internal_malloc_size (sizeof (GFC_INTEGER_4) + * retarray->dim[rank-1].stride + * extent[rank-1]); + retarray->base = 0; + retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + } + else + { + if (retarray->dim[0].stride == 0) + retarray->dim[0].stride = 1; + + if (rank != GFC_DESCRIPTOR_RANK (retarray)) + runtime_error ("rank of return array incorrect"); + } + for (n = 0; n < rank; n++) { count[n] = 0; |