/* Implementation of the MAXLOC intrinsic
- Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ Copyright (C) 2017-2024 Free Software Foundation, Inc.
Contributed by Thomas Koenig
This file is part of the GNU Fortran runtime library (libgfortran).
retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
if (alloc_size == 0)
- {
- /* Make sure we have a zero-sized array. */
- GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
- return;
-
- }
+ return;
}
else
{
}
len = GFC_DESCRIPTOR_EXTENT(array,dim);
- if (len <= 0)
- return;
+ if (len < 0)
+ len = 0;
mbase = mask->base_addr;
retarray->offset = 0;
retarray->dtype.rank = rank;
+ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
if (alloc_size == 0)
- {
- /* Make sure we have a zero-sized array. */
- GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
- return;
- }
- else
- retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
+ return;
}
else
{
alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
+ retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
if (alloc_size == 0)
- {
- /* Make sure we have a zero-sized array. */
- GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
- return;
- }
- else
- retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
+ return;
}
else
{