diff options
135 files changed, 6839 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8101aaea5a5..7256b6eb267 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,16 @@ +2006-03-20 Thomas Koenig <Thomas.Koenig@online.de> + + PR fortran/20935 + * iresolve.c (gfc_resolve_maxloc): If mask is scalar, + prefix the function name with an "s". If the mask is scalar + or if its kind is smaller than gfc_default_logical_kind, + coerce it to default kind. + (gfc_resolve_maxval): Likewise. + (gfc_resolve_minloc): Likewise. + (gfc_resolve_minval): Likewise. + (gfc_resolve_product): Likewise. + (gfc_resolve_sum): Likewise. + 2006-03-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/26741 diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index f961c776e21..df562f78604 100644 --- a/gcc/fortran/iresolve.c +++ b/gcc/fortran/iresolve.c @@ -1093,7 +1093,27 @@ gfc_resolve_maxloc (gfc_expr * f, gfc_expr * array, gfc_expr * dim, gfc_resolve_dim_arg (dim); } - name = mask ? "mmaxloc" : "maxloc"; + if (mask) + { + if (mask->rank == 0) + name = "smaxloc"; + else + name = "mmaxloc"; + + /* The mask can be kind 4 or 8 for the array case. For the + scalar case, coerce it to default kind unconditionally. */ + if ((mask->ts.kind < gfc_default_logical_kind) + || (mask->rank == 0 && mask->ts.kind != gfc_default_logical_kind)) + { + gfc_typespec ts; + ts.type = BT_LOGICAL; + ts.kind = gfc_default_logical_kind; + gfc_convert_type_warn (mask, &ts, 2, 0); + } + } + else + name = "maxloc"; + f->value.function.name = gfc_get_string (PREFIX("%s%d_%d_%c%d"), name, dim != NULL, f->ts.kind, gfc_type_letter (array->ts.type), array->ts.kind); @@ -1104,6 +1124,8 @@ void gfc_resolve_maxval (gfc_expr * f, gfc_expr * array, gfc_expr * dim, gfc_expr * mask) { + const char *name; + f->ts = array->ts; if (dim != NULL) @@ -1112,8 +1134,29 @@ gfc_resolve_maxval (gfc_expr * f, gfc_expr * array, gfc_expr * dim, gfc_resolve_dim_arg (dim); } + if (mask) + { + if (mask->rank == 0) + name = "smaxval"; + else + name = "mmaxval"; + + /* The mask can be kind 4 or 8 for the array case. For the + scalar case, coerce it to default kind unconditionally. */ + if ((mask->ts.kind < gfc_default_logical_kind) + || (mask->rank == 0 && mask->ts.kind != gfc_default_logical_kind)) + { + gfc_typespec ts; + ts.type = BT_LOGICAL; + ts.kind = gfc_default_logical_kind; + gfc_convert_type_warn (mask, &ts, 2, 0); + } + } + else + name = "maxval"; + f->value.function.name = - gfc_get_string (PREFIX("%s_%c%d"), mask ? "mmaxval" : "maxval", + gfc_get_string (PREFIX("%s_%c%d"), name, gfc_type_letter (array->ts.type), array->ts.kind); } @@ -1157,7 +1200,27 @@ gfc_resolve_minloc (gfc_expr * f, gfc_expr * array, gfc_expr * dim, gfc_resolve_dim_arg (dim); } - name = mask ? "mminloc" : "minloc"; + if (mask) + { + if (mask->rank == 0) + name = "sminloc"; + else + name = "mminloc"; + + /* The mask can be kind 4 or 8 for the array case. For the + scalar case, coerce it to default kind unconditionally. */ + if ((mask->ts.kind < gfc_default_logical_kind) + || (mask->rank == 0 && mask->ts.kind != gfc_default_logical_kind)) + { + gfc_typespec ts; + ts.type = BT_LOGICAL; + ts.kind = gfc_default_logical_kind; + gfc_convert_type_warn (mask, &ts, 2, 0); + } + } + else + name = "minloc"; + f->value.function.name = gfc_get_string (PREFIX("%s%d_%d_%c%d"), name, dim != NULL, f->ts.kind, gfc_type_letter (array->ts.type), array->ts.kind); @@ -1168,6 +1231,8 @@ void gfc_resolve_minval (gfc_expr * f, gfc_expr * array, gfc_expr * dim, gfc_expr * mask) { + const char *name; + f->ts = array->ts; if (dim != NULL) @@ -1176,8 +1241,29 @@ gfc_resolve_minval (gfc_expr * f, gfc_expr * array, gfc_expr * dim, gfc_resolve_dim_arg (dim); } + if (mask) + { + if (mask->rank == 0) + name = "sminval"; + else + name = "mminval"; + + /* The mask can be kind 4 or 8 for the array case. For the + scalar case, coerce it to default kind unconditionally. */ + if ((mask->ts.kind < gfc_default_logical_kind) + || (mask->rank == 0 && mask->ts.kind != gfc_default_logical_kind)) + { + gfc_typespec ts; + ts.type = BT_LOGICAL; + ts.kind = gfc_default_logical_kind; + gfc_convert_type_warn (mask, &ts, 2, 0); + } + } + else + name = "minval"; + f->value.function.name = - gfc_get_string (PREFIX("%s_%c%d"), mask ? "mminval" : "minval", + gfc_get_string (PREFIX("%s_%c%d"), name, gfc_type_letter (array->ts.type), array->ts.kind); } @@ -1311,6 +1397,8 @@ void gfc_resolve_product (gfc_expr * f, gfc_expr * array, gfc_expr * dim, gfc_expr * mask) { + const char *name; + f->ts = array->ts; if (dim != NULL) @@ -1319,8 +1407,29 @@ gfc_resolve_product (gfc_expr * f, gfc_expr * array, gfc_expr * dim, gfc_resolve_dim_arg (dim); } + if (mask) + { + if (mask->rank == 0) + name = "sproduct"; + else + name = "mproduct"; + + /* The mask can be kind 4 or 8 for the array case. For the + scalar case, coerce it to default kind unconditionally. */ + if ((mask->ts.kind < gfc_default_logical_kind) + || (mask->rank == 0 && mask->ts.kind != gfc_default_logical_kind)) + { + gfc_typespec ts; + ts.type = BT_LOGICAL; + ts.kind = gfc_default_logical_kind; + gfc_convert_type_warn (mask, &ts, 2, 0); + } + } + else + name = "product"; + f->value.function.name = - gfc_get_string (PREFIX("%s_%c%d"), mask ? "mproduct" : "product", + gfc_get_string (PREFIX("%s_%c%d"), name, gfc_type_letter (array->ts.type), array->ts.kind); } @@ -1733,8 +1842,31 @@ void gfc_resolve_sum (gfc_expr * f, gfc_expr * array, gfc_expr * dim, gfc_expr * mask) { + const char *name; + f->ts = array->ts; + if (mask) + { + if (mask->rank == 0) + name = "ssum"; + else + name = "msum"; + + /* The mask can be kind 4 or 8 for the array case. For the + scalar case, coerce it to default kind unconditionally. */ + if ((mask->ts.kind < gfc_default_logical_kind) + || (mask->rank == 0 && mask->ts.kind != gfc_default_logical_kind)) + { + gfc_typespec ts; + ts.type = BT_LOGICAL; + ts.kind = gfc_default_logical_kind; + gfc_convert_type_warn (mask, &ts, 2, 0); + } + } + else + name = "sum"; + if (dim != NULL) { f->rank = array->rank - 1; @@ -1742,7 +1874,7 @@ gfc_resolve_sum (gfc_expr * f, gfc_expr * array, gfc_expr * dim, } f->value.function.name = - gfc_get_string (PREFIX("%s_%c%d"), mask ? "msum" : "sum", + gfc_get_string (PREFIX("%s_%c%d"), name, gfc_type_letter (array->ts.type), array->ts.kind); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 92e62fc66fa..b7d52acf0d8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-03-20 Thomas Koenig <Thomas.Koenig@online.de> + + PR fortran/20935 + * gfortran.dg/scalar_mask_2.f90: New test case. + 2006-03-20 Andrew Pinski <pinskia@physics.uc.edu> PR tree-opt/26629 diff --git a/gcc/testsuite/gfortran.dg/scalar_mask_2.f90 b/gcc/testsuite/gfortran.dg/scalar_mask_2.f90 new file mode 100644 index 00000000000..adc7bbd60d4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/scalar_mask_2.f90 @@ -0,0 +1,32 @@ +! { dg-do run } +program main + ! Test scalar masks for different intrinsics. + real, dimension(2,2) :: a + logical(kind=2) :: lo + lo = .false. + a(1,1) = 1. + a(1,2) = -1. + a(2,1) = 13. + a(2,2) = -31. + if (any (minloc (a, lo) /= 0)) call abort + if (any (minloc (a, .true.) /= (/ 2, 2 /))) call abort + if (any (minloc(a, 1, .true.) /= (/ 1, 2/))) call abort + if (any (minloc(a, 1, lo ) /= (/ 0, 0/))) call abort + + if (any (maxloc (a, lo) /= 0)) call abort + if (any (maxloc (a, .true.) /= (/ 2,1 /))) call abort + if (any (maxloc(a, 1, .true.) /= (/ 2, 1/))) call abort + if (any (maxloc(a, 1, lo) /= (/ 0, 0/))) call abort + + if (any (maxval(a, 1, lo) /= -HUGE(a))) call abort + if (any (maxval(a, 1, .true.) /= (/13., -1./))) call abort + if (any (minval(a, 1, lo) /= HUGE(a))) call abort + if (any (minval(a, 1, .true.) /= (/1., -31./))) call abort + + if (any (product(a, 1, .true.) /= (/13., 31./))) call abort + if (any (product(a, 1, lo ) /= (/1., 1./))) call abort + + if (any (sum(a, 1, .true.) /= (/14., -32./))) call abort + if (any (sum(a, 1, lo) /= (/0., 0./))) call abort + +end program main diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 1ea7ffa35e4..9a0a8086f41 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,137 @@ +2006-03-20 Thomas Koenig <Thomas.Koenig@online.de> + + PR fortran/20935 + * m4/iforeach.m4: Add SCALAR_FOREACH_FUNCTION macro. + * m4/ifunction.m4: Add SCALAR_ARRAY_FUNCTION macro. + * m4/minloc0.m4: Use SCALAR_FOREACH_FUNCTION. + * m4/minloc1.m4: Use SCALAR_ARRAY_FUNCTION. + * m4/maxloc0.m4: Use SCALAR_FOREACH_FUNCTION. + * m4/maxloc1.m4: Use SCALAR_ARRAY_FUNCTION. + * m4/minval.m4: Likewise. + * m4/maxval.m4: Likewise. + * m4/product.m4: Likewise. + * m4/sum.m4: Likewise. + * minloc0_16_i16.c : Regenerated. + * minloc0_16_i4.c : Regenerated. + * minloc0_16_i8.c : Regenerated. + * minloc0_16_r10.c : Regenerated. + * minloc0_16_r16.c : Regenerated. + * minloc0_16_r4.c : Regenerated. + * minloc0_16_r8.c : Regenerated. + * minloc0_4_i16.c : Regenerated. + * minloc0_4_i4.c : Regenerated. + * minloc0_4_i8.c : Regenerated. + * minloc0_4_r10.c : Regenerated. + * minloc0_4_r16.c : Regenerated. + * minloc0_4_r4.c : Regenerated. + * minloc0_4_r8.c : Regenerated. + * minloc0_8_i16.c : Regenerated. + * minloc0_8_i4.c : Regenerated. + * minloc0_8_i8.c : Regenerated. + * minloc0_8_r10.c : Regenerated. + * minloc0_8_r16.c : Regenerated. + * minloc0_8_r4.c : Regenerated. + * minloc0_8_r8.c : Regenerated. + * minloc1_16_i16.c : Regenerated. + * minloc1_16_i4.c : Regenerated. + * minloc1_16_i8.c : Regenerated. + * minloc1_16_r10.c : Regenerated. + * minloc1_16_r16.c : Regenerated. + * minloc1_16_r4.c : Regenerated. + * minloc1_16_r8.c : Regenerated. + * minloc1_4_i16.c : Regenerated. + * minloc1_4_i4.c : Regenerated. + * minloc1_4_i8.c : Regenerated. + * minloc1_4_r10.c : Regenerated. + * minloc1_4_r16.c : Regenerated. + * minloc1_4_r4.c : Regenerated. + * minloc1_4_r8.c : Regenerated. + * minloc1_8_i16.c : Regenerated. + * minloc1_8_i4.c : Regenerated. + * minloc1_8_i8.c : Regenerated. + * minloc1_8_r10.c : Regenerated. + * minloc1_8_r16.c : Regenerated. + * minloc1_8_r4.c : Regenerated. + * minloc1_8_r8.c : Regenerated. + * maxloc0_16_i16.c : Regenerated. + * maxloc0_16_i4.c : Regenerated. + * maxloc0_16_i8.c : Regenerated. + * maxloc0_16_r10.c : Regenerated. + * maxloc0_16_r16.c : Regenerated. + * maxloc0_16_r4.c : Regenerated. + * maxloc0_16_r8.c : Regenerated. + * maxloc0_4_i16.c : Regenerated. + * maxloc0_4_i4.c : Regenerated. + * maxloc0_4_i8.c : Regenerated. + * maxloc0_4_r10.c : Regenerated. + * maxloc0_4_r16.c : Regenerated. + * maxloc0_4_r4.c : Regenerated. + * maxloc0_4_r8.c : Regenerated. + * maxloc0_8_i16.c : Regenerated. + * maxloc0_8_i4.c : Regenerated. + * maxloc0_8_i8.c : Regenerated. + * maxloc0_8_r10.c : Regenerated. + * maxloc0_8_r16.c : Regenerated. + * maxloc0_8_r4.c : Regenerated. + * maxloc0_8_r8.c : Regenerated. + * maxloc1_16_i16.c : Regenerated. + * maxloc1_16_i4.c : Regenerated. + * maxloc1_16_i8.c : Regenerated. + * maxloc1_16_r10.c : Regenerated. + * maxloc1_16_r16.c : Regenerated. + * maxloc1_16_r4.c : Regenerated. + * maxloc1_16_r8.c : Regenerated. + * maxloc1_4_i16.c : Regenerated. + * maxloc1_4_i4.c : Regenerated. + * maxloc1_4_i8.c : Regenerated. + * maxloc1_4_r10.c : Regenerated. + * maxloc1_4_r16.c : Regenerated. + * maxloc1_4_r4.c : Regenerated. + * maxloc1_4_r8.c : Regenerated. + * maxloc1_8_i16.c : Regenerated. + * maxloc1_8_i4.c : Regenerated. + * maxloc1_8_i8.c : Regenerated. + * maxloc1_8_r10.c : Regenerated. + * maxloc1_8_r16.c : Regenerated. + * maxloc1_8_r4.c : Regenerated. + * maxloc1_8_r8.c : Regenerated. + * maxval_i16.c : Regenerated. + * maxval_i4.c : Regenerated. + * maxval_i8.c : Regenerated. + * maxval_r10.c : Regenerated. + * maxval_r16.c : Regenerated. + * maxval_r4.c : Regenerated. + * maxval_r8.c : Regenerated. + * minval_i16.c : Regenerated. + * minval_i4.c : Regenerated. + * minval_i8.c : Regenerated. + * minval_r10.c : Regenerated. + * minval_r16.c : Regenerated. + * minval_r4.c : Regenerated. + * minval_r8.c : Regenerated. + * sum_c10.c : Regenerated. + * sum_c16.c : Regenerated. + * sum_c4.c : Regenerated. + * sum_c8.c : Regenerated. + * sum_i16.c : Regenerated. + * sum_i4.c : Regenerated. + * sum_i8.c : Regenerated. + * sum_r10.c : Regenerated. + * sum_r16.c : Regenerated. + * sum_r4.c : Regenerated. + * sum_r8.c : Regenerated. + * product_c10.c : Regenerated. + * product_c16.c : Regenerated. + * product_c4.c : Regenerated. + * product_c8.c : Regenerated. + * product_i16.c : Regenerated. + * product_i4.c : Regenerated. + * product_i8.c : Regenerated. + * product_r10.c : Regenerated. + * product_r16.c : Regenerated. + * product_r4.c : Regenerated. + * product_r8.c : Regenerated. + 2006-03-17 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/26509 diff --git a/libgfortran/generated/maxloc0_16_i16.c b/libgfortran/generated/maxloc0_16_i16.c index 93ad9e4ebd1..ab341d8bea9 100644 --- a/libgfortran/generated/maxloc0_16_i16.c +++ b/libgfortran/generated/maxloc0_16_i16.c @@ -293,4 +293,56 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc0_16_i16 (gfc_array_i16 * const restrict, + gfc_array_i16 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_16_i16); + +void +smaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, + gfc_array_i16 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc0_16_i16 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_16_i4.c b/libgfortran/generated/maxloc0_16_i4.c index 6808f693f29..51bee3154f6 100644 --- a/libgfortran/generated/maxloc0_16_i4.c +++ b/libgfortran/generated/maxloc0_16_i4.c @@ -293,4 +293,56 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc0_16_i4 (gfc_array_i16 * const restrict, + gfc_array_i4 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_16_i4); + +void +smaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, + gfc_array_i4 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc0_16_i4 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_16_i8.c b/libgfortran/generated/maxloc0_16_i8.c index ed3061add6f..dd8fb46a83a 100644 --- a/libgfortran/generated/maxloc0_16_i8.c +++ b/libgfortran/generated/maxloc0_16_i8.c @@ -293,4 +293,56 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc0_16_i8 (gfc_array_i16 * const restrict, + gfc_array_i8 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_16_i8); + +void +smaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, + gfc_array_i8 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc0_16_i8 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_16_r10.c b/libgfortran/generated/maxloc0_16_r10.c index e427ba50ef2..793885da8d7 100644 --- a/libgfortran/generated/maxloc0_16_r10.c +++ b/libgfortran/generated/maxloc0_16_r10.c @@ -293,4 +293,56 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc0_16_r10 (gfc_array_i16 * const restrict, + gfc_array_r10 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_16_r10); + +void +smaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, + gfc_array_r10 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc0_16_r10 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_16_r16.c b/libgfortran/generated/maxloc0_16_r16.c index b457997aedd..e3d0c7ff9c1 100644 --- a/libgfortran/generated/maxloc0_16_r16.c +++ b/libgfortran/generated/maxloc0_16_r16.c @@ -293,4 +293,56 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc0_16_r16 (gfc_array_i16 * const restrict, + gfc_array_r16 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_16_r16); + +void +smaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, + gfc_array_r16 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc0_16_r16 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_16_r4.c b/libgfortran/generated/maxloc0_16_r4.c index e9dbcbf9ce2..eedeaffda52 100644 --- a/libgfortran/generated/maxloc0_16_r4.c +++ b/libgfortran/generated/maxloc0_16_r4.c @@ -293,4 +293,56 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc0_16_r4 (gfc_array_i16 * const restrict, + gfc_array_r4 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_16_r4); + +void +smaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, + gfc_array_r4 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc0_16_r4 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_16_r8.c b/libgfortran/generated/maxloc0_16_r8.c index 07d7aef11f5..0e93c2a4d8e 100644 --- a/libgfortran/generated/maxloc0_16_r8.c +++ b/libgfortran/generated/maxloc0_16_r8.c @@ -293,4 +293,56 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc0_16_r8 (gfc_array_i16 * const restrict, + gfc_array_r8 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_16_r8); + +void +smaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, + gfc_array_r8 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc0_16_r8 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_4_i16.c b/libgfortran/generated/maxloc0_4_i16.c index 08f31808129..01d78701964 100644 --- a/libgfortran/generated/maxloc0_4_i16.c +++ b/libgfortran/generated/maxloc0_4_i16.c @@ -293,4 +293,56 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc0_4_i16 (gfc_array_i4 * const restrict, + gfc_array_i16 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_4_i16); + +void +smaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, + gfc_array_i16 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc0_4_i16 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_4_i4.c b/libgfortran/generated/maxloc0_4_i4.c index 9c342d90b82..7b1260c7e96 100644 --- a/libgfortran/generated/maxloc0_4_i4.c +++ b/libgfortran/generated/maxloc0_4_i4.c @@ -293,4 +293,56 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc0_4_i4 (gfc_array_i4 * const restrict, + gfc_array_i4 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_4_i4); + +void +smaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, + gfc_array_i4 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc0_4_i4 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_4_i8.c b/libgfortran/generated/maxloc0_4_i8.c index 9e3d66b872f..18b81c6a652 100644 --- a/libgfortran/generated/maxloc0_4_i8.c +++ b/libgfortran/generated/maxloc0_4_i8.c @@ -293,4 +293,56 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc0_4_i8 (gfc_array_i4 * const restrict, + gfc_array_i8 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_4_i8); + +void +smaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, + gfc_array_i8 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc0_4_i8 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_4_r10.c b/libgfortran/generated/maxloc0_4_r10.c index c44fedd6aa3..59e521c2421 100644 --- a/libgfortran/generated/maxloc0_4_r10.c +++ b/libgfortran/generated/maxloc0_4_r10.c @@ -293,4 +293,56 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc0_4_r10 (gfc_array_i4 * const restrict, + gfc_array_r10 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_4_r10); + +void +smaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, + gfc_array_r10 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc0_4_r10 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_4_r16.c b/libgfortran/generated/maxloc0_4_r16.c index e5ff44fe4a0..18bf738889f 100644 --- a/libgfortran/generated/maxloc0_4_r16.c +++ b/libgfortran/generated/maxloc0_4_r16.c @@ -293,4 +293,56 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc0_4_r16 (gfc_array_i4 * const restrict, + gfc_array_r16 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_4_r16); + +void +smaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, + gfc_array_r16 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc0_4_r16 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_4_r4.c b/libgfortran/generated/maxloc0_4_r4.c index f5dba470153..daa379c72d3 100644 --- a/libgfortran/generated/maxloc0_4_r4.c +++ b/libgfortran/generated/maxloc0_4_r4.c @@ -293,4 +293,56 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc0_4_r4 (gfc_array_i4 * const restrict, + gfc_array_r4 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_4_r4); + +void +smaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, + gfc_array_r4 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc0_4_r4 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_4_r8.c b/libgfortran/generated/maxloc0_4_r8.c index a82cedad3d3..063fed03fac 100644 --- a/libgfortran/generated/maxloc0_4_r8.c +++ b/libgfortran/generated/maxloc0_4_r8.c @@ -293,4 +293,56 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc0_4_r8 (gfc_array_i4 * const restrict, + gfc_array_r8 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_4_r8); + +void +smaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, + gfc_array_r8 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc0_4_r8 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_8_i16.c b/libgfortran/generated/maxloc0_8_i16.c index 35fd1f7cac7..1e1dbf25049 100644 --- a/libgfortran/generated/maxloc0_8_i16.c +++ b/libgfortran/generated/maxloc0_8_i16.c @@ -293,4 +293,56 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc0_8_i16 (gfc_array_i8 * const restrict, + gfc_array_i16 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_8_i16); + +void +smaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, + gfc_array_i16 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc0_8_i16 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_8_i4.c b/libgfortran/generated/maxloc0_8_i4.c index 16320bdb307..2a08cd82de4 100644 --- a/libgfortran/generated/maxloc0_8_i4.c +++ b/libgfortran/generated/maxloc0_8_i4.c @@ -293,4 +293,56 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc0_8_i4 (gfc_array_i8 * const restrict, + gfc_array_i4 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_8_i4); + +void +smaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, + gfc_array_i4 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc0_8_i4 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_8_i8.c b/libgfortran/generated/maxloc0_8_i8.c index 99ab4b940d8..b17a445e96f 100644 --- a/libgfortran/generated/maxloc0_8_i8.c +++ b/libgfortran/generated/maxloc0_8_i8.c @@ -293,4 +293,56 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc0_8_i8 (gfc_array_i8 * const restrict, + gfc_array_i8 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_8_i8); + +void +smaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, + gfc_array_i8 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc0_8_i8 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_8_r10.c b/libgfortran/generated/maxloc0_8_r10.c index eaaff9f5451..63c1467c54a 100644 --- a/libgfortran/generated/maxloc0_8_r10.c +++ b/libgfortran/generated/maxloc0_8_r10.c @@ -293,4 +293,56 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc0_8_r10 (gfc_array_i8 * const restrict, + gfc_array_r10 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_8_r10); + +void +smaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, + gfc_array_r10 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc0_8_r10 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_8_r16.c b/libgfortran/generated/maxloc0_8_r16.c index e0d1a427e15..c1fe42a71b8 100644 --- a/libgfortran/generated/maxloc0_8_r16.c +++ b/libgfortran/generated/maxloc0_8_r16.c @@ -293,4 +293,56 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc0_8_r16 (gfc_array_i8 * const restrict, + gfc_array_r16 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_8_r16); + +void +smaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, + gfc_array_r16 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc0_8_r16 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_8_r4.c b/libgfortran/generated/maxloc0_8_r4.c index 54047b5ed51..58de2ca0e46 100644 --- a/libgfortran/generated/maxloc0_8_r4.c +++ b/libgfortran/generated/maxloc0_8_r4.c @@ -293,4 +293,56 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc0_8_r4 (gfc_array_i8 * const restrict, + gfc_array_r4 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_8_r4); + +void +smaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, + gfc_array_r4 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc0_8_r4 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc0_8_r8.c b/libgfortran/generated/maxloc0_8_r8.c index 820d3a7ec8f..e286a819897 100644 --- a/libgfortran/generated/maxloc0_8_r8.c +++ b/libgfortran/generated/maxloc0_8_r8.c @@ -293,4 +293,56 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc0_8_r8 (gfc_array_i8 * const restrict, + gfc_array_r8 * const restrict, GFC_LOGICAL_4 *); +export_proto(smaxloc0_8_r8); + +void +smaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, + gfc_array_r8 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc0_8_r8 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/maxloc1_16_i16.c b/libgfortran/generated/maxloc1_16_i16.c index 9595ac33d40..9f6408b111c 100644 --- a/libgfortran/generated/maxloc1_16_i16.c +++ b/libgfortran/generated/maxloc1_16_i16.c @@ -350,4 +350,58 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc1_16_i16 (gfc_array_i16 * const restrict, + gfc_array_i16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_16_i16); + +void +smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, + gfc_array_i16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc1_16_i16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_16_i4.c b/libgfortran/generated/maxloc1_16_i4.c index cd668bbd6ee..7810033dfd2 100644 --- a/libgfortran/generated/maxloc1_16_i4.c +++ b/libgfortran/generated/maxloc1_16_i4.c @@ -350,4 +350,58 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc1_16_i4 (gfc_array_i16 * const restrict, + gfc_array_i4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_16_i4); + +void +smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, + gfc_array_i4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc1_16_i4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_16_i8.c b/libgfortran/generated/maxloc1_16_i8.c index ab665986b09..6c6a790a93c 100644 --- a/libgfortran/generated/maxloc1_16_i8.c +++ b/libgfortran/generated/maxloc1_16_i8.c @@ -350,4 +350,58 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc1_16_i8 (gfc_array_i16 * const restrict, + gfc_array_i8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_16_i8); + +void +smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, + gfc_array_i8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc1_16_i8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_16_r10.c b/libgfortran/generated/maxloc1_16_r10.c index 90606dd86e1..d122223ff37 100644 --- a/libgfortran/generated/maxloc1_16_r10.c +++ b/libgfortran/generated/maxloc1_16_r10.c @@ -350,4 +350,58 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc1_16_r10 (gfc_array_i16 * const restrict, + gfc_array_r10 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_16_r10); + +void +smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, + gfc_array_r10 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc1_16_r10 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_16_r16.c b/libgfortran/generated/maxloc1_16_r16.c index 0a1939c9cde..18d12256049 100644 --- a/libgfortran/generated/maxloc1_16_r16.c +++ b/libgfortran/generated/maxloc1_16_r16.c @@ -350,4 +350,58 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc1_16_r16 (gfc_array_i16 * const restrict, + gfc_array_r16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_16_r16); + +void +smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, + gfc_array_r16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc1_16_r16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_16_r4.c b/libgfortran/generated/maxloc1_16_r4.c index 445e8b093b7..f5fbcac366f 100644 --- a/libgfortran/generated/maxloc1_16_r4.c +++ b/libgfortran/generated/maxloc1_16_r4.c @@ -350,4 +350,58 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc1_16_r4 (gfc_array_i16 * const restrict, + gfc_array_r4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_16_r4); + +void +smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, + gfc_array_r4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc1_16_r4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_16_r8.c b/libgfortran/generated/maxloc1_16_r8.c index 3a663bb1094..40922e389e0 100644 --- a/libgfortran/generated/maxloc1_16_r8.c +++ b/libgfortran/generated/maxloc1_16_r8.c @@ -350,4 +350,58 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxloc1_16_r8 (gfc_array_i16 * const restrict, + gfc_array_r8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_16_r8); + +void +smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, + gfc_array_r8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxloc1_16_r8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_4_i16.c b/libgfortran/generated/maxloc1_4_i16.c index b881504cbe0..1dfb06d9cde 100644 --- a/libgfortran/generated/maxloc1_4_i16.c +++ b/libgfortran/generated/maxloc1_4_i16.c @@ -350,4 +350,58 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc1_4_i16 (gfc_array_i4 * const restrict, + gfc_array_i16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_4_i16); + +void +smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, + gfc_array_i16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc1_4_i16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_4_i4.c b/libgfortran/generated/maxloc1_4_i4.c index e8a053ec04a..ae016accbc2 100644 --- a/libgfortran/generated/maxloc1_4_i4.c +++ b/libgfortran/generated/maxloc1_4_i4.c @@ -350,4 +350,58 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc1_4_i4 (gfc_array_i4 * const restrict, + gfc_array_i4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_4_i4); + +void +smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, + gfc_array_i4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc1_4_i4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_4_i8.c b/libgfortran/generated/maxloc1_4_i8.c index ff5b7b9fe19..d55059bbe2a 100644 --- a/libgfortran/generated/maxloc1_4_i8.c +++ b/libgfortran/generated/maxloc1_4_i8.c @@ -350,4 +350,58 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc1_4_i8 (gfc_array_i4 * const restrict, + gfc_array_i8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_4_i8); + +void +smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, + gfc_array_i8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc1_4_i8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_4_r10.c b/libgfortran/generated/maxloc1_4_r10.c index 306cfe98671..70a0b7b2b78 100644 --- a/libgfortran/generated/maxloc1_4_r10.c +++ b/libgfortran/generated/maxloc1_4_r10.c @@ -350,4 +350,58 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc1_4_r10 (gfc_array_i4 * const restrict, + gfc_array_r10 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_4_r10); + +void +smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, + gfc_array_r10 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc1_4_r10 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_4_r16.c b/libgfortran/generated/maxloc1_4_r16.c index 6f6cd22b27a..e3abb9c02ba 100644 --- a/libgfortran/generated/maxloc1_4_r16.c +++ b/libgfortran/generated/maxloc1_4_r16.c @@ -350,4 +350,58 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc1_4_r16 (gfc_array_i4 * const restrict, + gfc_array_r16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_4_r16); + +void +smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, + gfc_array_r16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc1_4_r16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_4_r4.c b/libgfortran/generated/maxloc1_4_r4.c index 3795ed80d55..bcecc57d02e 100644 --- a/libgfortran/generated/maxloc1_4_r4.c +++ b/libgfortran/generated/maxloc1_4_r4.c @@ -350,4 +350,58 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc1_4_r4 (gfc_array_i4 * const restrict, + gfc_array_r4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_4_r4); + +void +smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, + gfc_array_r4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc1_4_r4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_4_r8.c b/libgfortran/generated/maxloc1_4_r8.c index 82d4a6710c9..5bcf032557d 100644 --- a/libgfortran/generated/maxloc1_4_r8.c +++ b/libgfortran/generated/maxloc1_4_r8.c @@ -350,4 +350,58 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxloc1_4_r8 (gfc_array_i4 * const restrict, + gfc_array_r8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_4_r8); + +void +smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, + gfc_array_r8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxloc1_4_r8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_8_i16.c b/libgfortran/generated/maxloc1_8_i16.c index 69cb35ec5f9..8d5491a4b6d 100644 --- a/libgfortran/generated/maxloc1_8_i16.c +++ b/libgfortran/generated/maxloc1_8_i16.c @@ -350,4 +350,58 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc1_8_i16 (gfc_array_i8 * const restrict, + gfc_array_i16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_8_i16); + +void +smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, + gfc_array_i16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc1_8_i16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_8_i4.c b/libgfortran/generated/maxloc1_8_i4.c index 6857896d5b5..5c187e25daa 100644 --- a/libgfortran/generated/maxloc1_8_i4.c +++ b/libgfortran/generated/maxloc1_8_i4.c @@ -350,4 +350,58 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc1_8_i4 (gfc_array_i8 * const restrict, + gfc_array_i4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_8_i4); + +void +smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, + gfc_array_i4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc1_8_i4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_8_i8.c b/libgfortran/generated/maxloc1_8_i8.c index 5c5f8368b53..ea123178940 100644 --- a/libgfortran/generated/maxloc1_8_i8.c +++ b/libgfortran/generated/maxloc1_8_i8.c @@ -350,4 +350,58 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc1_8_i8 (gfc_array_i8 * const restrict, + gfc_array_i8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_8_i8); + +void +smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, + gfc_array_i8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc1_8_i8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_8_r10.c b/libgfortran/generated/maxloc1_8_r10.c index e4f17d49b8e..40972e64840 100644 --- a/libgfortran/generated/maxloc1_8_r10.c +++ b/libgfortran/generated/maxloc1_8_r10.c @@ -350,4 +350,58 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc1_8_r10 (gfc_array_i8 * const restrict, + gfc_array_r10 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_8_r10); + +void +smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, + gfc_array_r10 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc1_8_r10 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_8_r16.c b/libgfortran/generated/maxloc1_8_r16.c index 0a5dd515e9d..11f3e05aa75 100644 --- a/libgfortran/generated/maxloc1_8_r16.c +++ b/libgfortran/generated/maxloc1_8_r16.c @@ -350,4 +350,58 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc1_8_r16 (gfc_array_i8 * const restrict, + gfc_array_r16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_8_r16); + +void +smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, + gfc_array_r16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc1_8_r16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_8_r4.c b/libgfortran/generated/maxloc1_8_r4.c index 15a82f24921..10bd416338e 100644 --- a/libgfortran/generated/maxloc1_8_r4.c +++ b/libgfortran/generated/maxloc1_8_r4.c @@ -350,4 +350,58 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc1_8_r4 (gfc_array_i8 * const restrict, + gfc_array_r4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_8_r4); + +void +smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, + gfc_array_r4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc1_8_r4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxloc1_8_r8.c b/libgfortran/generated/maxloc1_8_r8.c index c89135e2f3a..534e6cd80d6 100644 --- a/libgfortran/generated/maxloc1_8_r8.c +++ b/libgfortran/generated/maxloc1_8_r8.c @@ -350,4 +350,58 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxloc1_8_r8 (gfc_array_i8 * const restrict, + gfc_array_r8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxloc1_8_r8); + +void +smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, + gfc_array_r8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxloc1_8_r8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/maxval_i16.c b/libgfortran/generated/maxval_i16.c index 9ae812ed7ea..2b505803daf 100644 --- a/libgfortran/generated/maxval_i16.c +++ b/libgfortran/generated/maxval_i16.c @@ -339,4 +339,58 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, } } + +extern void smaxval_i16 (gfc_array_i16 * const restrict, + gfc_array_i16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxval_i16); + +void +smaxval_i16 (gfc_array_i16 * const restrict retarray, + gfc_array_i16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + maxval_i16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = -GFC_INTEGER_16_HUGE ; +} + #endif diff --git a/libgfortran/generated/maxval_i4.c b/libgfortran/generated/maxval_i4.c index 3ee7ce04edd..65136953239 100644 --- a/libgfortran/generated/maxval_i4.c +++ b/libgfortran/generated/maxval_i4.c @@ -339,4 +339,58 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, } } + +extern void smaxval_i4 (gfc_array_i4 * const restrict, + gfc_array_i4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxval_i4); + +void +smaxval_i4 (gfc_array_i4 * const restrict retarray, + gfc_array_i4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + maxval_i4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = -GFC_INTEGER_4_HUGE ; +} + #endif diff --git a/libgfortran/generated/maxval_i8.c b/libgfortran/generated/maxval_i8.c index f2cf7fc908f..fe78be161a6 100644 --- a/libgfortran/generated/maxval_i8.c +++ b/libgfortran/generated/maxval_i8.c @@ -339,4 +339,58 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, } } + +extern void smaxval_i8 (gfc_array_i8 * const restrict, + gfc_array_i8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxval_i8); + +void +smaxval_i8 (gfc_array_i8 * const restrict retarray, + gfc_array_i8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + maxval_i8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = -GFC_INTEGER_8_HUGE ; +} + #endif diff --git a/libgfortran/generated/maxval_r10.c b/libgfortran/generated/maxval_r10.c index 9efa92aac8d..5f9c5db89fe 100644 --- a/libgfortran/generated/maxval_r10.c +++ b/libgfortran/generated/maxval_r10.c @@ -339,4 +339,58 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, } } + +extern void smaxval_r10 (gfc_array_r10 * const restrict, + gfc_array_r10 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxval_r10); + +void +smaxval_r10 (gfc_array_r10 * const restrict retarray, + gfc_array_r10 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_10 *dest; + + if (*mask) + { + maxval_r10 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_10) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = -GFC_REAL_10_HUGE ; +} + #endif diff --git a/libgfortran/generated/maxval_r16.c b/libgfortran/generated/maxval_r16.c index a4d27be7316..a52669164cc 100644 --- a/libgfortran/generated/maxval_r16.c +++ b/libgfortran/generated/maxval_r16.c @@ -339,4 +339,58 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, } } + +extern void smaxval_r16 (gfc_array_r16 * const restrict, + gfc_array_r16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxval_r16); + +void +smaxval_r16 (gfc_array_r16 * const restrict retarray, + gfc_array_r16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_16 *dest; + + if (*mask) + { + maxval_r16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = -GFC_REAL_16_HUGE ; +} + #endif diff --git a/libgfortran/generated/maxval_r4.c b/libgfortran/generated/maxval_r4.c index 42f95a18adb..23cee97d5e0 100644 --- a/libgfortran/generated/maxval_r4.c +++ b/libgfortran/generated/maxval_r4.c @@ -339,4 +339,58 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, } } + +extern void smaxval_r4 (gfc_array_r4 * const restrict, + gfc_array_r4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxval_r4); + +void +smaxval_r4 (gfc_array_r4 * const restrict retarray, + gfc_array_r4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_4 *dest; + + if (*mask) + { + maxval_r4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = -GFC_REAL_4_HUGE ; +} + #endif diff --git a/libgfortran/generated/maxval_r8.c b/libgfortran/generated/maxval_r8.c index f70442506dc..2fd37e5fa9b 100644 --- a/libgfortran/generated/maxval_r8.c +++ b/libgfortran/generated/maxval_r8.c @@ -339,4 +339,58 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, } } + +extern void smaxval_r8 (gfc_array_r8 * const restrict, + gfc_array_r8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(smaxval_r8); + +void +smaxval_r8 (gfc_array_r8 * const restrict retarray, + gfc_array_r8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_8 *dest; + + if (*mask) + { + maxval_r8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = -GFC_REAL_8_HUGE ; +} + #endif diff --git a/libgfortran/generated/minloc0_16_i16.c b/libgfortran/generated/minloc0_16_i16.c index 7bf58e32789..d41276d9230 100644 --- a/libgfortran/generated/minloc0_16_i16.c +++ b/libgfortran/generated/minloc0_16_i16.c @@ -293,4 +293,56 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc0_16_i16 (gfc_array_i16 * const restrict, + gfc_array_i16 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_16_i16); + +void +sminloc0_16_i16 (gfc_array_i16 * const restrict retarray, + gfc_array_i16 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc0_16_i16 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_16_i4.c b/libgfortran/generated/minloc0_16_i4.c index b42205bd6b4..16e08638005 100644 --- a/libgfortran/generated/minloc0_16_i4.c +++ b/libgfortran/generated/minloc0_16_i4.c @@ -293,4 +293,56 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc0_16_i4 (gfc_array_i16 * const restrict, + gfc_array_i4 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_16_i4); + +void +sminloc0_16_i4 (gfc_array_i16 * const restrict retarray, + gfc_array_i4 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc0_16_i4 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_16_i8.c b/libgfortran/generated/minloc0_16_i8.c index c687d10b716..bd2f08a56d1 100644 --- a/libgfortran/generated/minloc0_16_i8.c +++ b/libgfortran/generated/minloc0_16_i8.c @@ -293,4 +293,56 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc0_16_i8 (gfc_array_i16 * const restrict, + gfc_array_i8 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_16_i8); + +void +sminloc0_16_i8 (gfc_array_i16 * const restrict retarray, + gfc_array_i8 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc0_16_i8 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_16_r10.c b/libgfortran/generated/minloc0_16_r10.c index 99ae91d7fc0..ab88d299975 100644 --- a/libgfortran/generated/minloc0_16_r10.c +++ b/libgfortran/generated/minloc0_16_r10.c @@ -293,4 +293,56 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc0_16_r10 (gfc_array_i16 * const restrict, + gfc_array_r10 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_16_r10); + +void +sminloc0_16_r10 (gfc_array_i16 * const restrict retarray, + gfc_array_r10 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc0_16_r10 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_16_r16.c b/libgfortran/generated/minloc0_16_r16.c index d727f4c91e6..c71a24081aa 100644 --- a/libgfortran/generated/minloc0_16_r16.c +++ b/libgfortran/generated/minloc0_16_r16.c @@ -293,4 +293,56 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc0_16_r16 (gfc_array_i16 * const restrict, + gfc_array_r16 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_16_r16); + +void +sminloc0_16_r16 (gfc_array_i16 * const restrict retarray, + gfc_array_r16 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc0_16_r16 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_16_r4.c b/libgfortran/generated/minloc0_16_r4.c index 501a668efd6..4cfa38934e9 100644 --- a/libgfortran/generated/minloc0_16_r4.c +++ b/libgfortran/generated/minloc0_16_r4.c @@ -293,4 +293,56 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc0_16_r4 (gfc_array_i16 * const restrict, + gfc_array_r4 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_16_r4); + +void +sminloc0_16_r4 (gfc_array_i16 * const restrict retarray, + gfc_array_r4 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc0_16_r4 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_16_r8.c b/libgfortran/generated/minloc0_16_r8.c index 57783b6c174..52ef10b5867 100644 --- a/libgfortran/generated/minloc0_16_r8.c +++ b/libgfortran/generated/minloc0_16_r8.c @@ -293,4 +293,56 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc0_16_r8 (gfc_array_i16 * const restrict, + gfc_array_r8 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_16_r8); + +void +sminloc0_16_r8 (gfc_array_i16 * const restrict retarray, + gfc_array_r8 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc0_16_r8 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_4_i16.c b/libgfortran/generated/minloc0_4_i16.c index b71fbaa286d..5486e93739d 100644 --- a/libgfortran/generated/minloc0_4_i16.c +++ b/libgfortran/generated/minloc0_4_i16.c @@ -293,4 +293,56 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc0_4_i16 (gfc_array_i4 * const restrict, + gfc_array_i16 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_4_i16); + +void +sminloc0_4_i16 (gfc_array_i4 * const restrict retarray, + gfc_array_i16 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc0_4_i16 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_4_i4.c b/libgfortran/generated/minloc0_4_i4.c index c655b1ac713..519b10ecf3a 100644 --- a/libgfortran/generated/minloc0_4_i4.c +++ b/libgfortran/generated/minloc0_4_i4.c @@ -293,4 +293,56 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc0_4_i4 (gfc_array_i4 * const restrict, + gfc_array_i4 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_4_i4); + +void +sminloc0_4_i4 (gfc_array_i4 * const restrict retarray, + gfc_array_i4 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc0_4_i4 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_4_i8.c b/libgfortran/generated/minloc0_4_i8.c index 7f94829c47d..3988838666b 100644 --- a/libgfortran/generated/minloc0_4_i8.c +++ b/libgfortran/generated/minloc0_4_i8.c @@ -293,4 +293,56 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc0_4_i8 (gfc_array_i4 * const restrict, + gfc_array_i8 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_4_i8); + +void +sminloc0_4_i8 (gfc_array_i4 * const restrict retarray, + gfc_array_i8 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc0_4_i8 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_4_r10.c b/libgfortran/generated/minloc0_4_r10.c index a29677d03bc..5c0ccfbb59f 100644 --- a/libgfortran/generated/minloc0_4_r10.c +++ b/libgfortran/generated/minloc0_4_r10.c @@ -293,4 +293,56 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc0_4_r10 (gfc_array_i4 * const restrict, + gfc_array_r10 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_4_r10); + +void +sminloc0_4_r10 (gfc_array_i4 * const restrict retarray, + gfc_array_r10 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc0_4_r10 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_4_r16.c b/libgfortran/generated/minloc0_4_r16.c index 61cf4b1b9de..fbb75bab50c 100644 --- a/libgfortran/generated/minloc0_4_r16.c +++ b/libgfortran/generated/minloc0_4_r16.c @@ -293,4 +293,56 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc0_4_r16 (gfc_array_i4 * const restrict, + gfc_array_r16 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_4_r16); + +void +sminloc0_4_r16 (gfc_array_i4 * const restrict retarray, + gfc_array_r16 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc0_4_r16 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_4_r4.c b/libgfortran/generated/minloc0_4_r4.c index f55bbae1f4a..911117696ea 100644 --- a/libgfortran/generated/minloc0_4_r4.c +++ b/libgfortran/generated/minloc0_4_r4.c @@ -293,4 +293,56 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc0_4_r4 (gfc_array_i4 * const restrict, + gfc_array_r4 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_4_r4); + +void +sminloc0_4_r4 (gfc_array_i4 * const restrict retarray, + gfc_array_r4 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc0_4_r4 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_4_r8.c b/libgfortran/generated/minloc0_4_r8.c index d8a2f825432..461bedb9dfb 100644 --- a/libgfortran/generated/minloc0_4_r8.c +++ b/libgfortran/generated/minloc0_4_r8.c @@ -293,4 +293,56 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc0_4_r8 (gfc_array_i4 * const restrict, + gfc_array_r8 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_4_r8); + +void +sminloc0_4_r8 (gfc_array_i4 * const restrict retarray, + gfc_array_r8 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc0_4_r8 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_8_i16.c b/libgfortran/generated/minloc0_8_i16.c index a6346cfa609..92bb0a22519 100644 --- a/libgfortran/generated/minloc0_8_i16.c +++ b/libgfortran/generated/minloc0_8_i16.c @@ -293,4 +293,56 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc0_8_i16 (gfc_array_i8 * const restrict, + gfc_array_i16 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_8_i16); + +void +sminloc0_8_i16 (gfc_array_i8 * const restrict retarray, + gfc_array_i16 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc0_8_i16 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_8_i4.c b/libgfortran/generated/minloc0_8_i4.c index 2aa54535bc7..6229244751f 100644 --- a/libgfortran/generated/minloc0_8_i4.c +++ b/libgfortran/generated/minloc0_8_i4.c @@ -293,4 +293,56 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc0_8_i4 (gfc_array_i8 * const restrict, + gfc_array_i4 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_8_i4); + +void +sminloc0_8_i4 (gfc_array_i8 * const restrict retarray, + gfc_array_i4 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc0_8_i4 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_8_i8.c b/libgfortran/generated/minloc0_8_i8.c index 63dd21a7766..01090ed9366 100644 --- a/libgfortran/generated/minloc0_8_i8.c +++ b/libgfortran/generated/minloc0_8_i8.c @@ -293,4 +293,56 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc0_8_i8 (gfc_array_i8 * const restrict, + gfc_array_i8 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_8_i8); + +void +sminloc0_8_i8 (gfc_array_i8 * const restrict retarray, + gfc_array_i8 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc0_8_i8 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_8_r10.c b/libgfortran/generated/minloc0_8_r10.c index c627e7eeb14..8bd4251829a 100644 --- a/libgfortran/generated/minloc0_8_r10.c +++ b/libgfortran/generated/minloc0_8_r10.c @@ -293,4 +293,56 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc0_8_r10 (gfc_array_i8 * const restrict, + gfc_array_r10 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_8_r10); + +void +sminloc0_8_r10 (gfc_array_i8 * const restrict retarray, + gfc_array_r10 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc0_8_r10 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_8_r16.c b/libgfortran/generated/minloc0_8_r16.c index d4e307187a2..ea229d7e403 100644 --- a/libgfortran/generated/minloc0_8_r16.c +++ b/libgfortran/generated/minloc0_8_r16.c @@ -293,4 +293,56 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc0_8_r16 (gfc_array_i8 * const restrict, + gfc_array_r16 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_8_r16); + +void +sminloc0_8_r16 (gfc_array_i8 * const restrict retarray, + gfc_array_r16 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc0_8_r16 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_8_r4.c b/libgfortran/generated/minloc0_8_r4.c index c484e8d325b..e91466e28ad 100644 --- a/libgfortran/generated/minloc0_8_r4.c +++ b/libgfortran/generated/minloc0_8_r4.c @@ -293,4 +293,56 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc0_8_r4 (gfc_array_i8 * const restrict, + gfc_array_r4 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_8_r4); + +void +sminloc0_8_r4 (gfc_array_i8 * const restrict retarray, + gfc_array_r4 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc0_8_r4 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc0_8_r8.c b/libgfortran/generated/minloc0_8_r8.c index 97f19cefff4..00d3718f92f 100644 --- a/libgfortran/generated/minloc0_8_r8.c +++ b/libgfortran/generated/minloc0_8_r8.c @@ -293,4 +293,56 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc0_8_r8 (gfc_array_i8 * const restrict, + gfc_array_r8 * const restrict, GFC_LOGICAL_4 *); +export_proto(sminloc0_8_r8); + +void +sminloc0_8_r8 (gfc_array_i8 * const restrict retarray, + gfc_array_r8 * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc0_8_r8 (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = 0 ; +} #endif diff --git a/libgfortran/generated/minloc1_16_i16.c b/libgfortran/generated/minloc1_16_i16.c index 75e505494a3..5c49e798e06 100644 --- a/libgfortran/generated/minloc1_16_i16.c +++ b/libgfortran/generated/minloc1_16_i16.c @@ -350,4 +350,58 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc1_16_i16 (gfc_array_i16 * const restrict, + gfc_array_i16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_16_i16); + +void +sminloc1_16_i16 (gfc_array_i16 * const restrict retarray, + gfc_array_i16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc1_16_i16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_16_i4.c b/libgfortran/generated/minloc1_16_i4.c index d2fdd541483..cba6b90cfb8 100644 --- a/libgfortran/generated/minloc1_16_i4.c +++ b/libgfortran/generated/minloc1_16_i4.c @@ -350,4 +350,58 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc1_16_i4 (gfc_array_i16 * const restrict, + gfc_array_i4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_16_i4); + +void +sminloc1_16_i4 (gfc_array_i16 * const restrict retarray, + gfc_array_i4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc1_16_i4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_16_i8.c b/libgfortran/generated/minloc1_16_i8.c index 19ac6d77352..ba8be3987ad 100644 --- a/libgfortran/generated/minloc1_16_i8.c +++ b/libgfortran/generated/minloc1_16_i8.c @@ -350,4 +350,58 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc1_16_i8 (gfc_array_i16 * const restrict, + gfc_array_i8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_16_i8); + +void +sminloc1_16_i8 (gfc_array_i16 * const restrict retarray, + gfc_array_i8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc1_16_i8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_16_r10.c b/libgfortran/generated/minloc1_16_r10.c index cc3d59b0256..3553c224faa 100644 --- a/libgfortran/generated/minloc1_16_r10.c +++ b/libgfortran/generated/minloc1_16_r10.c @@ -350,4 +350,58 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc1_16_r10 (gfc_array_i16 * const restrict, + gfc_array_r10 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_16_r10); + +void +sminloc1_16_r10 (gfc_array_i16 * const restrict retarray, + gfc_array_r10 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc1_16_r10 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_16_r16.c b/libgfortran/generated/minloc1_16_r16.c index 76e8787ad62..258a5e21561 100644 --- a/libgfortran/generated/minloc1_16_r16.c +++ b/libgfortran/generated/minloc1_16_r16.c @@ -350,4 +350,58 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc1_16_r16 (gfc_array_i16 * const restrict, + gfc_array_r16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_16_r16); + +void +sminloc1_16_r16 (gfc_array_i16 * const restrict retarray, + gfc_array_r16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc1_16_r16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_16_r4.c b/libgfortran/generated/minloc1_16_r4.c index 46ed3b63280..86ba6670040 100644 --- a/libgfortran/generated/minloc1_16_r4.c +++ b/libgfortran/generated/minloc1_16_r4.c @@ -350,4 +350,58 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc1_16_r4 (gfc_array_i16 * const restrict, + gfc_array_r4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_16_r4); + +void +sminloc1_16_r4 (gfc_array_i16 * const restrict retarray, + gfc_array_r4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc1_16_r4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_16_r8.c b/libgfortran/generated/minloc1_16_r8.c index 2d8bbf915f6..1fe86e5019c 100644 --- a/libgfortran/generated/minloc1_16_r8.c +++ b/libgfortran/generated/minloc1_16_r8.c @@ -350,4 +350,58 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, } } + +extern void sminloc1_16_r8 (gfc_array_i16 * const restrict, + gfc_array_r8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_16_r8); + +void +sminloc1_16_r8 (gfc_array_i16 * const restrict retarray, + gfc_array_r8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minloc1_16_r8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_4_i16.c b/libgfortran/generated/minloc1_4_i16.c index 94712f4ecec..5952d216005 100644 --- a/libgfortran/generated/minloc1_4_i16.c +++ b/libgfortran/generated/minloc1_4_i16.c @@ -350,4 +350,58 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc1_4_i16 (gfc_array_i4 * const restrict, + gfc_array_i16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_4_i16); + +void +sminloc1_4_i16 (gfc_array_i4 * const restrict retarray, + gfc_array_i16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc1_4_i16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_4_i4.c b/libgfortran/generated/minloc1_4_i4.c index a80d2c68d07..79321f14a81 100644 --- a/libgfortran/generated/minloc1_4_i4.c +++ b/libgfortran/generated/minloc1_4_i4.c @@ -350,4 +350,58 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc1_4_i4 (gfc_array_i4 * const restrict, + gfc_array_i4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_4_i4); + +void +sminloc1_4_i4 (gfc_array_i4 * const restrict retarray, + gfc_array_i4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc1_4_i4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_4_i8.c b/libgfortran/generated/minloc1_4_i8.c index 55c837034e4..625328beac9 100644 --- a/libgfortran/generated/minloc1_4_i8.c +++ b/libgfortran/generated/minloc1_4_i8.c @@ -350,4 +350,58 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc1_4_i8 (gfc_array_i4 * const restrict, + gfc_array_i8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_4_i8); + +void +sminloc1_4_i8 (gfc_array_i4 * const restrict retarray, + gfc_array_i8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc1_4_i8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_4_r10.c b/libgfortran/generated/minloc1_4_r10.c index 1d9b7547ec2..ab4d5b415b7 100644 --- a/libgfortran/generated/minloc1_4_r10.c +++ b/libgfortran/generated/minloc1_4_r10.c @@ -350,4 +350,58 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc1_4_r10 (gfc_array_i4 * const restrict, + gfc_array_r10 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_4_r10); + +void +sminloc1_4_r10 (gfc_array_i4 * const restrict retarray, + gfc_array_r10 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc1_4_r10 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_4_r16.c b/libgfortran/generated/minloc1_4_r16.c index df903cb2d3d..9ffdd331dda 100644 --- a/libgfortran/generated/minloc1_4_r16.c +++ b/libgfortran/generated/minloc1_4_r16.c @@ -350,4 +350,58 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc1_4_r16 (gfc_array_i4 * const restrict, + gfc_array_r16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_4_r16); + +void +sminloc1_4_r16 (gfc_array_i4 * const restrict retarray, + gfc_array_r16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc1_4_r16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_4_r4.c b/libgfortran/generated/minloc1_4_r4.c index e723e92d20c..a91ee8da0de 100644 --- a/libgfortran/generated/minloc1_4_r4.c +++ b/libgfortran/generated/minloc1_4_r4.c @@ -350,4 +350,58 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc1_4_r4 (gfc_array_i4 * const restrict, + gfc_array_r4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_4_r4); + +void +sminloc1_4_r4 (gfc_array_i4 * const restrict retarray, + gfc_array_r4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc1_4_r4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_4_r8.c b/libgfortran/generated/minloc1_4_r8.c index 5fbf3ec0482..355333d20a5 100644 --- a/libgfortran/generated/minloc1_4_r8.c +++ b/libgfortran/generated/minloc1_4_r8.c @@ -350,4 +350,58 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, } } + +extern void sminloc1_4_r8 (gfc_array_i4 * const restrict, + gfc_array_r8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_4_r8); + +void +sminloc1_4_r8 (gfc_array_i4 * const restrict retarray, + gfc_array_r8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minloc1_4_r8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_8_i16.c b/libgfortran/generated/minloc1_8_i16.c index 07cbf78c511..4e78589fc60 100644 --- a/libgfortran/generated/minloc1_8_i16.c +++ b/libgfortran/generated/minloc1_8_i16.c @@ -350,4 +350,58 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc1_8_i16 (gfc_array_i8 * const restrict, + gfc_array_i16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_8_i16); + +void +sminloc1_8_i16 (gfc_array_i8 * const restrict retarray, + gfc_array_i16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc1_8_i16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_8_i4.c b/libgfortran/generated/minloc1_8_i4.c index 917c0b274ba..ae71c33ff50 100644 --- a/libgfortran/generated/minloc1_8_i4.c +++ b/libgfortran/generated/minloc1_8_i4.c @@ -350,4 +350,58 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc1_8_i4 (gfc_array_i8 * const restrict, + gfc_array_i4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_8_i4); + +void +sminloc1_8_i4 (gfc_array_i8 * const restrict retarray, + gfc_array_i4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc1_8_i4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_8_i8.c b/libgfortran/generated/minloc1_8_i8.c index c9a15276176..31cc82213a0 100644 --- a/libgfortran/generated/minloc1_8_i8.c +++ b/libgfortran/generated/minloc1_8_i8.c @@ -350,4 +350,58 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc1_8_i8 (gfc_array_i8 * const restrict, + gfc_array_i8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_8_i8); + +void +sminloc1_8_i8 (gfc_array_i8 * const restrict retarray, + gfc_array_i8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc1_8_i8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_8_r10.c b/libgfortran/generated/minloc1_8_r10.c index c36838c10d8..3dd3b1eca1c 100644 --- a/libgfortran/generated/minloc1_8_r10.c +++ b/libgfortran/generated/minloc1_8_r10.c @@ -350,4 +350,58 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc1_8_r10 (gfc_array_i8 * const restrict, + gfc_array_r10 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_8_r10); + +void +sminloc1_8_r10 (gfc_array_i8 * const restrict retarray, + gfc_array_r10 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc1_8_r10 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_8_r16.c b/libgfortran/generated/minloc1_8_r16.c index 93352946319..9de92d07d3e 100644 --- a/libgfortran/generated/minloc1_8_r16.c +++ b/libgfortran/generated/minloc1_8_r16.c @@ -350,4 +350,58 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc1_8_r16 (gfc_array_i8 * const restrict, + gfc_array_r16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_8_r16); + +void +sminloc1_8_r16 (gfc_array_i8 * const restrict retarray, + gfc_array_r16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc1_8_r16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_8_r4.c b/libgfortran/generated/minloc1_8_r4.c index 69ebc29e0d0..a47ef259afa 100644 --- a/libgfortran/generated/minloc1_8_r4.c +++ b/libgfortran/generated/minloc1_8_r4.c @@ -350,4 +350,58 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc1_8_r4 (gfc_array_i8 * const restrict, + gfc_array_r4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_8_r4); + +void +sminloc1_8_r4 (gfc_array_i8 * const restrict retarray, + gfc_array_r4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc1_8_r4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minloc1_8_r8.c b/libgfortran/generated/minloc1_8_r8.c index 7d662d5016b..2637fe6351f 100644 --- a/libgfortran/generated/minloc1_8_r8.c +++ b/libgfortran/generated/minloc1_8_r8.c @@ -350,4 +350,58 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, } } + +extern void sminloc1_8_r8 (gfc_array_i8 * const restrict, + gfc_array_r8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminloc1_8_r8); + +void +sminloc1_8_r8 (gfc_array_i8 * const restrict retarray, + gfc_array_r8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minloc1_8_r8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/minval_i16.c b/libgfortran/generated/minval_i16.c index 5b34eafaaf7..f1c2e3852e6 100644 --- a/libgfortran/generated/minval_i16.c +++ b/libgfortran/generated/minval_i16.c @@ -339,4 +339,58 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, } } + +extern void sminval_i16 (gfc_array_i16 * const restrict, + gfc_array_i16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminval_i16); + +void +sminval_i16 (gfc_array_i16 * const restrict retarray, + gfc_array_i16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + minval_i16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = GFC_INTEGER_16_HUGE ; +} + #endif diff --git a/libgfortran/generated/minval_i4.c b/libgfortran/generated/minval_i4.c index bcdb55f3120..bb79787119d 100644 --- a/libgfortran/generated/minval_i4.c +++ b/libgfortran/generated/minval_i4.c @@ -339,4 +339,58 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, } } + +extern void sminval_i4 (gfc_array_i4 * const restrict, + gfc_array_i4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminval_i4); + +void +sminval_i4 (gfc_array_i4 * const restrict retarray, + gfc_array_i4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + minval_i4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = GFC_INTEGER_4_HUGE ; +} + #endif diff --git a/libgfortran/generated/minval_i8.c b/libgfortran/generated/minval_i8.c index eb37d4824b9..deb53391221 100644 --- a/libgfortran/generated/minval_i8.c +++ b/libgfortran/generated/minval_i8.c @@ -339,4 +339,58 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, } } + +extern void sminval_i8 (gfc_array_i8 * const restrict, + gfc_array_i8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminval_i8); + +void +sminval_i8 (gfc_array_i8 * const restrict retarray, + gfc_array_i8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + minval_i8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = GFC_INTEGER_8_HUGE ; +} + #endif diff --git a/libgfortran/generated/minval_r10.c b/libgfortran/generated/minval_r10.c index a52e5a1b35a..be02a66dab9 100644 --- a/libgfortran/generated/minval_r10.c +++ b/libgfortran/generated/minval_r10.c @@ -339,4 +339,58 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, } } + +extern void sminval_r10 (gfc_array_r10 * const restrict, + gfc_array_r10 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminval_r10); + +void +sminval_r10 (gfc_array_r10 * const restrict retarray, + gfc_array_r10 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_10 *dest; + + if (*mask) + { + minval_r10 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_10) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = GFC_REAL_10_HUGE ; +} + #endif diff --git a/libgfortran/generated/minval_r16.c b/libgfortran/generated/minval_r16.c index 61ecd81746f..cacd524fff0 100644 --- a/libgfortran/generated/minval_r16.c +++ b/libgfortran/generated/minval_r16.c @@ -339,4 +339,58 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, } } + +extern void sminval_r16 (gfc_array_r16 * const restrict, + gfc_array_r16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminval_r16); + +void +sminval_r16 (gfc_array_r16 * const restrict retarray, + gfc_array_r16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_16 *dest; + + if (*mask) + { + minval_r16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = GFC_REAL_16_HUGE ; +} + #endif diff --git a/libgfortran/generated/minval_r4.c b/libgfortran/generated/minval_r4.c index 4eafed2eda1..0f383d97a4c 100644 --- a/libgfortran/generated/minval_r4.c +++ b/libgfortran/generated/minval_r4.c @@ -339,4 +339,58 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, } } + +extern void sminval_r4 (gfc_array_r4 * const restrict, + gfc_array_r4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminval_r4); + +void +sminval_r4 (gfc_array_r4 * const restrict retarray, + gfc_array_r4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_4 *dest; + + if (*mask) + { + minval_r4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = GFC_REAL_4_HUGE ; +} + #endif diff --git a/libgfortran/generated/minval_r8.c b/libgfortran/generated/minval_r8.c index 6b83f9b05d3..31ba6193565 100644 --- a/libgfortran/generated/minval_r8.c +++ b/libgfortran/generated/minval_r8.c @@ -339,4 +339,58 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, } } + +extern void sminval_r8 (gfc_array_r8 * const restrict, + gfc_array_r8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sminval_r8); + +void +sminval_r8 (gfc_array_r8 * const restrict retarray, + gfc_array_r8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_8 *dest; + + if (*mask) + { + minval_r8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = GFC_REAL_8_HUGE ; +} + #endif diff --git a/libgfortran/generated/product_c10.c b/libgfortran/generated/product_c10.c index bc1e9f0aef2..59552f276d5 100644 --- a/libgfortran/generated/product_c10.c +++ b/libgfortran/generated/product_c10.c @@ -337,4 +337,58 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, } } + +extern void sproduct_c10 (gfc_array_c10 * const restrict, + gfc_array_c10 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sproduct_c10); + +void +sproduct_c10 (gfc_array_c10 * const restrict retarray, + gfc_array_c10 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_COMPLEX_10 *dest; + + if (*mask) + { + product_c10 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_COMPLEX_10) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 1 ; +} + #endif diff --git a/libgfortran/generated/product_c16.c b/libgfortran/generated/product_c16.c index c5ac52fb834..97b6ac1a219 100644 --- a/libgfortran/generated/product_c16.c +++ b/libgfortran/generated/product_c16.c @@ -337,4 +337,58 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, } } + +extern void sproduct_c16 (gfc_array_c16 * const restrict, + gfc_array_c16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sproduct_c16); + +void +sproduct_c16 (gfc_array_c16 * const restrict retarray, + gfc_array_c16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_COMPLEX_16 *dest; + + if (*mask) + { + product_c16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_COMPLEX_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 1 ; +} + #endif diff --git a/libgfortran/generated/product_c4.c b/libgfortran/generated/product_c4.c index c8e932bdde2..14dc21eaabe 100644 --- a/libgfortran/generated/product_c4.c +++ b/libgfortran/generated/product_c4.c @@ -337,4 +337,58 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, } } + +extern void sproduct_c4 (gfc_array_c4 * const restrict, + gfc_array_c4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sproduct_c4); + +void +sproduct_c4 (gfc_array_c4 * const restrict retarray, + gfc_array_c4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_COMPLEX_4 *dest; + + if (*mask) + { + product_c4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_COMPLEX_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 1 ; +} + #endif diff --git a/libgfortran/generated/product_c8.c b/libgfortran/generated/product_c8.c index 56485797edb..3313f2ab174 100644 --- a/libgfortran/generated/product_c8.c +++ b/libgfortran/generated/product_c8.c @@ -337,4 +337,58 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, } } + +extern void sproduct_c8 (gfc_array_c8 * const restrict, + gfc_array_c8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sproduct_c8); + +void +sproduct_c8 (gfc_array_c8 * const restrict retarray, + gfc_array_c8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_COMPLEX_8 *dest; + + if (*mask) + { + product_c8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_COMPLEX_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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 1 ; +} + #endif diff --git a/libgfortran/generated/product_i16.c b/libgfortran/generated/product_i16.c index 2b2f314f5cc..7079dc43413 100644 --- a/libgfortran/generated/product_i16.c +++ b/libgfortran/generated/product_i16.c @@ -337,4 +337,58 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, } } + +extern void sproduct_i16 (gfc_array_i16 * const restrict, + gfc_array_i16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sproduct_i16); + +void +sproduct_i16 (gfc_array_i16 * const restrict retarray, + gfc_array_i16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + product_i16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 1 ; +} + #endif diff --git a/libgfortran/generated/product_i4.c b/libgfortran/generated/product_i4.c index 19a7858e414..da88e97556e 100644 --- a/libgfortran/generated/product_i4.c +++ b/libgfortran/generated/product_i4.c @@ -337,4 +337,58 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, } } + +extern void sproduct_i4 (gfc_array_i4 * const restrict, + gfc_array_i4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sproduct_i4); + +void +sproduct_i4 (gfc_array_i4 * const restrict retarray, + gfc_array_i4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + product_i4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 1 ; +} + #endif diff --git a/libgfortran/generated/product_i8.c b/libgfortran/generated/product_i8.c index 22b513530de..c60e8f76572 100644 --- a/libgfortran/generated/product_i8.c +++ b/libgfortran/generated/product_i8.c @@ -337,4 +337,58 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, } } + +extern void sproduct_i8 (gfc_array_i8 * const restrict, + gfc_array_i8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sproduct_i8); + +void +sproduct_i8 (gfc_array_i8 * const restrict retarray, + gfc_array_i8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + product_i8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 1 ; +} + #endif diff --git a/libgfortran/generated/product_r10.c b/libgfortran/generated/product_r10.c index 9777df66a29..710216fff83 100644 --- a/libgfortran/generated/product_r10.c +++ b/libgfortran/generated/product_r10.c @@ -337,4 +337,58 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, } } + +extern void sproduct_r10 (gfc_array_r10 * const restrict, + gfc_array_r10 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sproduct_r10); + +void +sproduct_r10 (gfc_array_r10 * const restrict retarray, + gfc_array_r10 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_10 *dest; + + if (*mask) + { + product_r10 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_10) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 1 ; +} + #endif diff --git a/libgfortran/generated/product_r16.c b/libgfortran/generated/product_r16.c index e9d84eab314..b6df4ddbb2a 100644 --- a/libgfortran/generated/product_r16.c +++ b/libgfortran/generated/product_r16.c @@ -337,4 +337,58 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, } } + +extern void sproduct_r16 (gfc_array_r16 * const restrict, + gfc_array_r16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sproduct_r16); + +void +sproduct_r16 (gfc_array_r16 * const restrict retarray, + gfc_array_r16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_16 *dest; + + if (*mask) + { + product_r16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 1 ; +} + #endif diff --git a/libgfortran/generated/product_r4.c b/libgfortran/generated/product_r4.c index 8b421d36539..e31b3945279 100644 --- a/libgfortran/generated/product_r4.c +++ b/libgfortran/generated/product_r4.c @@ -337,4 +337,58 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, } } + +extern void sproduct_r4 (gfc_array_r4 * const restrict, + gfc_array_r4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sproduct_r4); + +void +sproduct_r4 (gfc_array_r4 * const restrict retarray, + gfc_array_r4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_4 *dest; + + if (*mask) + { + product_r4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 1 ; +} + #endif diff --git a/libgfortran/generated/product_r8.c b/libgfortran/generated/product_r8.c index 57094cf6f0a..a2e805c0d33 100644 --- a/libgfortran/generated/product_r8.c +++ b/libgfortran/generated/product_r8.c @@ -337,4 +337,58 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, } } + +extern void sproduct_r8 (gfc_array_r8 * const restrict, + gfc_array_r8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(sproduct_r8); + +void +sproduct_r8 (gfc_array_r8 * const restrict retarray, + gfc_array_r8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_8 *dest; + + if (*mask) + { + product_r8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 1 ; +} + #endif diff --git a/libgfortran/generated/sum_c10.c b/libgfortran/generated/sum_c10.c index 393f04ece4c..344fd3ff386 100644 --- a/libgfortran/generated/sum_c10.c +++ b/libgfortran/generated/sum_c10.c @@ -337,4 +337,58 @@ msum_c10 (gfc_array_c10 * const restrict retarray, } } + +extern void ssum_c10 (gfc_array_c10 * const restrict, + gfc_array_c10 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(ssum_c10); + +void +ssum_c10 (gfc_array_c10 * const restrict retarray, + gfc_array_c10 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_COMPLEX_10 *dest; + + if (*mask) + { + sum_c10 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_COMPLEX_10) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/sum_c16.c b/libgfortran/generated/sum_c16.c index 9e5c8edb138..8cdf9766c53 100644 --- a/libgfortran/generated/sum_c16.c +++ b/libgfortran/generated/sum_c16.c @@ -337,4 +337,58 @@ msum_c16 (gfc_array_c16 * const restrict retarray, } } + +extern void ssum_c16 (gfc_array_c16 * const restrict, + gfc_array_c16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(ssum_c16); + +void +ssum_c16 (gfc_array_c16 * const restrict retarray, + gfc_array_c16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_COMPLEX_16 *dest; + + if (*mask) + { + sum_c16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_COMPLEX_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/sum_c4.c b/libgfortran/generated/sum_c4.c index 72d28f8afa0..1e113ad85ce 100644 --- a/libgfortran/generated/sum_c4.c +++ b/libgfortran/generated/sum_c4.c @@ -337,4 +337,58 @@ msum_c4 (gfc_array_c4 * const restrict retarray, } } + +extern void ssum_c4 (gfc_array_c4 * const restrict, + gfc_array_c4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(ssum_c4); + +void +ssum_c4 (gfc_array_c4 * const restrict retarray, + gfc_array_c4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_COMPLEX_4 *dest; + + if (*mask) + { + sum_c4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_COMPLEX_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/sum_c8.c b/libgfortran/generated/sum_c8.c index 485b46d75fb..eec1b783826 100644 --- a/libgfortran/generated/sum_c8.c +++ b/libgfortran/generated/sum_c8.c @@ -337,4 +337,58 @@ msum_c8 (gfc_array_c8 * const restrict retarray, } } + +extern void ssum_c8 (gfc_array_c8 * const restrict, + gfc_array_c8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(ssum_c8); + +void +ssum_c8 (gfc_array_c8 * const restrict retarray, + gfc_array_c8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_COMPLEX_8 *dest; + + if (*mask) + { + sum_c8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_COMPLEX_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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/sum_i16.c b/libgfortran/generated/sum_i16.c index 00446895d0a..2a378361ff3 100644 --- a/libgfortran/generated/sum_i16.c +++ b/libgfortran/generated/sum_i16.c @@ -337,4 +337,58 @@ msum_i16 (gfc_array_i16 * const restrict retarray, } } + +extern void ssum_i16 (gfc_array_i16 * const restrict, + gfc_array_i16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(ssum_i16); + +void +ssum_i16 (gfc_array_i16 * const restrict retarray, + gfc_array_i16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_16 *dest; + + if (*mask) + { + sum_i16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/sum_i4.c b/libgfortran/generated/sum_i4.c index f00c4ea3f15..4062a3bbe15 100644 --- a/libgfortran/generated/sum_i4.c +++ b/libgfortran/generated/sum_i4.c @@ -337,4 +337,58 @@ msum_i4 (gfc_array_i4 * const restrict retarray, } } + +extern void ssum_i4 (gfc_array_i4 * const restrict, + gfc_array_i4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(ssum_i4); + +void +ssum_i4 (gfc_array_i4 * const restrict retarray, + gfc_array_i4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_4 *dest; + + if (*mask) + { + sum_i4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/sum_i8.c b/libgfortran/generated/sum_i8.c index 78505da9865..ce02c063488 100644 --- a/libgfortran/generated/sum_i8.c +++ b/libgfortran/generated/sum_i8.c @@ -337,4 +337,58 @@ msum_i8 (gfc_array_i8 * const restrict retarray, } } + +extern void ssum_i8 (gfc_array_i8 * const restrict, + gfc_array_i8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(ssum_i8); + +void +ssum_i8 (gfc_array_i8 * const restrict retarray, + gfc_array_i8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_INTEGER_8 *dest; + + if (*mask) + { + sum_i8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/sum_r10.c b/libgfortran/generated/sum_r10.c index 49071021f0d..07f6ae397fc 100644 --- a/libgfortran/generated/sum_r10.c +++ b/libgfortran/generated/sum_r10.c @@ -337,4 +337,58 @@ msum_r10 (gfc_array_r10 * const restrict retarray, } } + +extern void ssum_r10 (gfc_array_r10 * const restrict, + gfc_array_r10 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(ssum_r10); + +void +ssum_r10 (gfc_array_r10 * const restrict retarray, + gfc_array_r10 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_10 *dest; + + if (*mask) + { + sum_r10 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_10) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/sum_r16.c b/libgfortran/generated/sum_r16.c index eddd45b8646..975bc258536 100644 --- a/libgfortran/generated/sum_r16.c +++ b/libgfortran/generated/sum_r16.c @@ -337,4 +337,58 @@ msum_r16 (gfc_array_r16 * const restrict retarray, } } + +extern void ssum_r16 (gfc_array_r16 * const restrict, + gfc_array_r16 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(ssum_r16); + +void +ssum_r16 (gfc_array_r16 * const restrict retarray, + gfc_array_r16 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_16 *dest; + + if (*mask) + { + sum_r16 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_16) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/sum_r4.c b/libgfortran/generated/sum_r4.c index 97bf717ba5a..db905ae4c13 100644 --- a/libgfortran/generated/sum_r4.c +++ b/libgfortran/generated/sum_r4.c @@ -337,4 +337,58 @@ msum_r4 (gfc_array_r4 * const restrict retarray, } } + +extern void ssum_r4 (gfc_array_r4 * const restrict, + gfc_array_r4 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(ssum_r4); + +void +ssum_r4 (gfc_array_r4 * const restrict retarray, + gfc_array_r4 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_4 *dest; + + if (*mask) + { + sum_r4 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_4) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/generated/sum_r8.c b/libgfortran/generated/sum_r8.c index 0f3b49c278b..ed2440be39a 100644 --- a/libgfortran/generated/sum_r8.c +++ b/libgfortran/generated/sum_r8.c @@ -337,4 +337,58 @@ msum_r8 (gfc_array_r8 * const restrict retarray, } } + +extern void ssum_r8 (gfc_array_r8 * const restrict, + gfc_array_r8 * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(ssum_r8); + +void +ssum_r8 (gfc_array_r8 * const restrict retarray, + gfc_array_r8 * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + GFC_REAL_8 *dest; + + if (*mask) + { + sum_r8 (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (GFC_REAL_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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = 0 ; +} + #endif diff --git a/libgfortran/m4/iforeach.m4 b/libgfortran/m4/iforeach.m4 index cfe563952bb..7d20213e9aa 100644 --- a/libgfortran/m4/iforeach.m4 +++ b/libgfortran/m4/iforeach.m4 @@ -248,3 +248,56 @@ $1 START_MASKED_FOREACH_BLOCK $2 FINISH_MASKED_FOREACH_FUNCTION')dnl +define(SCALAR_FOREACH_FUNCTION, +` +extern void `s'name`'rtype_qual`_'atype_code (rtype * const restrict, + atype * const restrict, GFC_LOGICAL_4 *); +export_proto(`s'name`'rtype_qual`_'atype_code); + +void +`s'name`'rtype_qual`_'atype_code (rtype * const restrict retarray, + atype * const restrict array, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type dstride; + index_type n; + rtype_name *dest; + + if (*mask) + { + name`'rtype_qual`_'atype_code (retarray, array); + return; + } + + rank = GFC_DESCRIPTOR_RANK (array); + + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (rtype_name) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + for (n = 0; n<rank; n++) + dest[n * dstride] = $1 ; +}')dnl diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4 index caf9dbaab8d..d1a34da00b1 100644 --- a/libgfortran/m4/ifunction.m4 +++ b/libgfortran/m4/ifunction.m4 @@ -317,6 +317,60 @@ define(FINISH_MASKED_ARRAY_FUNCTION, } } }')dnl +define(SCALAR_ARRAY_FUNCTION, +` +extern void `s'name`'rtype_qual`_'atype_code (rtype * const restrict, + atype * const restrict, const index_type * const restrict, + GFC_LOGICAL_4 *); +export_proto(`s'name`'rtype_qual`_'atype_code); + +void +`s'name`'rtype_qual`_'atype_code (rtype * const restrict retarray, + atype * const restrict array, + const index_type * const restrict pdim, + GFC_LOGICAL_4 * mask) +{ + index_type rank; + index_type n; + index_type dstride; + rtype_name *dest; + + if (*mask) + { + name`'rtype_qual`_'atype_code (retarray, array, pdim); + return; + } + rank = GFC_DESCRIPTOR_RANK (array); + 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->offset = 0; + retarray->data = internal_malloc_size (sizeof (rtype_name) * 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; + } + + dstride = retarray->dim[0].stride; + dest = retarray->data; + + for (n = 0; n < rank; n++) + dest[n * dstride] = $1 ; +}')dnl define(ARRAY_FUNCTION, `START_ARRAY_FUNCTION $2 diff --git a/libgfortran/m4/maxloc0.m4 b/libgfortran/m4/maxloc0.m4 index 9feaa4b99b8..a7e88f0b2ce 100644 --- a/libgfortran/m4/maxloc0.m4 +++ b/libgfortran/m4/maxloc0.m4 @@ -64,4 +64,5 @@ MASKED_FOREACH_FUNCTION( dest[n * dstride] = count[n] + 1; }') +SCALAR_FOREACH_FUNCTION(`0') #endif diff --git a/libgfortran/m4/maxloc1.m4 b/libgfortran/m4/maxloc1.m4 index 161368482f6..3a6ed5ad974 100644 --- a/libgfortran/m4/maxloc1.m4 +++ b/libgfortran/m4/maxloc1.m4 @@ -60,4 +60,6 @@ MASKED_ARRAY_FUNCTION(0, result = (rtype_name)n + 1; }') +SCALAR_ARRAY_FUNCTION(0) + #endif diff --git a/libgfortran/m4/maxval.m4 b/libgfortran/m4/maxval.m4 index 9bdf0d07cdd..07cbbdd6ac6 100644 --- a/libgfortran/m4/maxval.m4 +++ b/libgfortran/m4/maxval.m4 @@ -49,4 +49,6 @@ MASKED_ARRAY_FUNCTION(atype_min, ` if (*msrc && *src > result) result = *src;') +SCALAR_ARRAY_FUNCTION(atype_min) + #endif diff --git a/libgfortran/m4/minloc0.m4 b/libgfortran/m4/minloc0.m4 index 1c2aa18cf08..33bfe312a54 100644 --- a/libgfortran/m4/minloc0.m4 +++ b/libgfortran/m4/minloc0.m4 @@ -64,4 +64,5 @@ MASKED_FOREACH_FUNCTION( dest[n * dstride] = count[n] + 1; }') +SCALAR_FOREACH_FUNCTION(`0') #endif diff --git a/libgfortran/m4/minloc1.m4 b/libgfortran/m4/minloc1.m4 index 0c116eb63be..f923ca80410 100644 --- a/libgfortran/m4/minloc1.m4 +++ b/libgfortran/m4/minloc1.m4 @@ -60,4 +60,6 @@ MASKED_ARRAY_FUNCTION(0, result = (rtype_name)n + 1; }') +SCALAR_ARRAY_FUNCTION(0) + #endif diff --git a/libgfortran/m4/minval.m4 b/libgfortran/m4/minval.m4 index 9bd37f4d1fb..af02319c1dd 100644 --- a/libgfortran/m4/minval.m4 +++ b/libgfortran/m4/minval.m4 @@ -49,4 +49,6 @@ MASKED_ARRAY_FUNCTION(atype_max, ` if (*msrc && *src < result) result = *src;') +SCALAR_ARRAY_FUNCTION(atype_max) + #endif diff --git a/libgfortran/m4/product.m4 b/libgfortran/m4/product.m4 index df77372e8b0..47ee25b8b80 100644 --- a/libgfortran/m4/product.m4 +++ b/libgfortran/m4/product.m4 @@ -47,4 +47,6 @@ MASKED_ARRAY_FUNCTION(1, ` if (*msrc) result *= *src;') +SCALAR_ARRAY_FUNCTION(1) + #endif diff --git a/libgfortran/m4/sum.m4 b/libgfortran/m4/sum.m4 index 1d91c0d5100..a9406882cfa 100644 --- a/libgfortran/m4/sum.m4 +++ b/libgfortran/m4/sum.m4 @@ -47,4 +47,6 @@ MASKED_ARRAY_FUNCTION(0, ` if (*msrc) result += *src;') +SCALAR_ARRAY_FUNCTION(0) + #endif |