/* Implementation of the MAXLOC intrinsic
- Copyright 2002, 2007, 2009 Free Software Foundation, Inc.
+ Copyright 2002, 2007, 2009, 2010 Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
* extent[rank-1];
+ retarray->data = internal_malloc_size (alloc_size);
if (alloc_size == 0)
{
/* Make sure we have a zero-sized array. */
return;
}
- else
- retarray->data = internal_malloc_size (alloc_size);
}
else
{
count[n] = 0;
dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
if (extent[n] <= 0)
- len = 0;
+ return;
}
base = array->data;
result = (GFC_INTEGER_8)n + 1;
}
}
+
*dest = result;
}
}
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
- index_type sstride[GFC_MAX_DIMENSIONS];
index_type dstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
index_type rank;
for (n = 0; n < dim; n++)
{
- sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n);
extent[n] = GFC_DESCRIPTOR_EXTENT(array,n);
if (extent[n] <= 0)
for (n = dim; n < rank; n++)
{
- sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1);
extent[n] =
GFC_DESCRIPTOR_EXTENT(array,n + 1);