summaryrefslogtreecommitdiff
path: root/libgfortran/generated/maxloc0_4_s1.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/generated/maxloc0_4_s1.c')
-rw-r--r--libgfortran/generated/maxloc0_4_s1.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/libgfortran/generated/maxloc0_4_s1.c b/libgfortran/generated/maxloc0_4_s1.c
index b13a9b94146..ba8e6340118 100644
--- a/libgfortran/generated/maxloc0_4_s1.c
+++ b/libgfortran/generated/maxloc0_4_s1.c
@@ -61,10 +61,6 @@ maxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
index_type rank;
index_type n;
-#ifdef HAVE_BACK_ARG
- assert (back == 0);
-#endif
-
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
runtime_error ("Rank of array needs to be > 0");
@@ -107,7 +103,7 @@ maxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
{
const GFC_INTEGER_1 *maxval;
- maxval = base;
+ maxval = NULL;
while (base)
{
@@ -115,7 +111,8 @@ maxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
{
/* Implementation start. */
- if (compare_fcn (base, maxval, len) > 0)
+ if (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0 :
+ compare_fcn (base, maxval, len) > 0))
{
maxval = base;
for (n = 0; n < rank; n++)
@@ -177,9 +174,6 @@ mmaxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
index_type n;
int mask_kind;
-#ifdef HAVE_BACK_ARG
- assert (back == 0);
-#endif
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
runtime_error ("Rank of array needs to be > 0");
@@ -250,7 +244,9 @@ mmaxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
{
/* Implementation start. */
- if (*mbase && (maxval == NULL || compare_fcn (base, maxval, len) > 0))
+ if (*mbase &&
+ (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0:
+ compare_fcn (base, maxval, len) > 0)))
{
maxval = base;
for (n = 0; n < rank; n++)