summaryrefslogtreecommitdiff
path: root/libgfortran/generated/minloc0_8_i4.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/generated/minloc0_8_i4.c')
-rw-r--r--libgfortran/generated/minloc0_8_i4.c59
1 files changed, 46 insertions, 13 deletions
diff --git a/libgfortran/generated/minloc0_8_i4.c b/libgfortran/generated/minloc0_8_i4.c
index 2b401149f8f..340c54d8aee 100644
--- a/libgfortran/generated/minloc0_8_i4.c
+++ b/libgfortran/generated/minloc0_8_i4.c
@@ -53,13 +53,31 @@ minloc0_8_i4 (gfc_array_i8 * retarray, gfc_array_i4 *array)
index_type n;
rank = GFC_DESCRIPTOR_RANK (array);
- assert (rank > 0);
- assert (GFC_DESCRIPTOR_RANK (retarray) == 1);
- assert (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound == rank);
+ if (rank <= 0)
+ runtime_error ("Rank of array needs to be > 0");
+
+ if (retarray->data == NULL)
+ {
+ retarray->dim[0].lbound = 0;
+ retarray->dim[0].ubound = rank-1;
+ retarray->dim[0].stride = 1;
+ retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+ retarray->base = 0;
+ retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+ }
+ else
+ {
+ if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+ runtime_error ("rank of return array does not equal 1");
+
+ if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+ runtime_error ("dimension of return array incorrect");
+
+ if (retarray->dim[0].stride == 0)
+ retarray->dim[0].stride = 1;
+ }
if (array->dim[0].stride == 0)
array->dim[0].stride = 1;
- if (retarray->dim[0].stride == 0)
- retarray->dim[0].stride = 1;
dstride = retarray->dim[0].stride;
dest = retarray->data;
@@ -150,17 +168,32 @@ mminloc0_8_i4 (gfc_array_i8 * retarray, gfc_array_i4 *array,
index_type n;
rank = GFC_DESCRIPTOR_RANK (array);
- assert (rank > 0);
- assert (GFC_DESCRIPTOR_RANK (retarray) == 1);
- assert (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound == rank);
- assert (GFC_DESCRIPTOR_RANK (mask) == rank);
+ if (rank <= 0)
+ runtime_error ("Rank of array needs to be > 0");
+
+ if (retarray->data == NULL)
+ {
+ retarray->dim[0].lbound = 0;
+ retarray->dim[0].ubound = rank-1;
+ retarray->dim[0].stride = 1;
+ retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+ retarray->base = 0;
+ retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+ }
+ else
+ {
+ if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+ runtime_error ("rank of return array does not equal 1");
+
+ if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+ runtime_error ("dimension of return array incorrect");
+
+ if (retarray->dim[0].stride == 0)
+ retarray->dim[0].stride = 1;
+ }
if (array->dim[0].stride == 0)
array->dim[0].stride = 1;
- if (retarray->dim[0].stride == 0)
- retarray->dim[0].stride = 1;
- if (retarray->dim[0].stride == 0)
- retarray->dim[0].stride = 1;
dstride = retarray->dim[0].stride;
dest = retarray->data;