/* Implementation of the MINLOC intrinsic
- Copyright (C) 2002-2018 Free Software Foundation, Inc.
+ Copyright (C) 2002-2024 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran 95 runtime library (libgfortran).
if (retarray->base_addr == NULL)
{
GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
- GFC_DTYPE_COPY_SETRANK(retarray,retarray,1);
+ retarray->dtype.rank = 1;
retarray->offset = 0;
retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
}
}
else
#endif
- if (back)
- do
- {
- if (unlikely (*base <= minval))
- {
- minval = *base;
- for (n = 0; n < rank; n++)
- dest[n * dstride] = count[n] + 1;
- }
- base += sstride[0];
- }
- while (++count[0] != extent[0]);
- else
- do
- {
- if (unlikely (*base < minval))
- {
- minval = *base;
- for (n = 0; n < rank; n++)
- dest[n * dstride] = count[n] + 1;
- }
+ if (back)
+ do
+ {
+ if (unlikely (*base <= minval))
+ {
+ minval = *base;
+ for (n = 0; n < rank; n++)
+ dest[n * dstride] = count[n] + 1;
+ }
+ base += sstride[0];
+ }
+ while (++count[0] != extent[0]);
+ else
+ do
+ {
+ if (unlikely (*base < minval))
+ {
+ minval = *base;
+ for (n = 0; n < rank; n++)
+ dest[n * dstride] = count[n] + 1;
+ }
/* Implementation end. */
/* Advance to the next element. */
base += sstride[0];
index_type n;
int mask_kind;
+
+ if (mask == NULL)
+ {
+ minloc0_16_r4 (retarray, array, back);
+ return;
+ }
+
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
runtime_error ("Rank of array needs to be > 0");
if (retarray->base_addr == NULL)
{
GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
- GFC_DTYPE_COPY_SETRANK(retarray,retarray,1);
+ retarray->dtype.rank = 1;
retarray->offset = 0;
retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
}
index_type n;
GFC_INTEGER_16 *dest;
- if (*mask)
+ if (mask == NULL || *mask)
{
minloc0_16_r4 (retarray, array, back);
return;
if (retarray->base_addr == NULL)
{
GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
- GFC_DTYPE_COPY_SETRANK(retarray,retarray,1);
+ retarray->dtype.rank = 1;
retarray->offset = 0;
retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
}