https://gcc.gnu.org/g:ec249be3c287c6f1dfb328712ac9c39e6fa95eca

commit r16-591-gec249be3c287c6f1dfb328712ac9c39e6fa95eca
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue May 13 14:14:55 2025 +0200

    fortran: Fix up minloc/maxloc lowering [PR120191]
    
    We need to drop the kind argument from what is passed to the
    library, but need to do it not only when one uses the argument name
    for it (so kind=4 etc.) but also when one passes all the arguments
    to the intrinsics.
    
    The following patch uses what gfc_conv_intrinsic_findloc uses,
    which looks more efficient and cleaner, we already set automatic
    vars to point to the kind and back actual arguments, so we can just
    free/clear expr on the former and set name to "%VAL" on the latter.
    
    And similarly clears dim argument for the BT_CHARACTER case when using
    maxloc2/minloc2, again regardless of whether it was named or not.
    
    2025-05-13  Jakub Jelinek  <ja...@redhat.com>
                Daniil Kochergin  <daniil24...@gmail.com>
                Tobias Burnus  <tbur...@baylibre.com>
    
            PR fortran/120191
            * trans-intrinsic.cc (strip_kind_from_actual): Remove.
            (gfc_conv_intrinsic_minmaxloc): Don't call strip_kind_from_actual.
            Free and clear kind_arg->expr if non-NULL.  Set back_arg->name to
            "%VAL" instead of a loop looking for last argument.  Remove actual
            variable, use array_arg instead.  Free and clear dim_arg->expr if
            non-NULL for BT_CHARACTER cases instead of using a loop.
    
            * gfortran.dg/pr120191_1.f90: New test.

Diff:
---
 gcc/fortran/trans-intrinsic.cc           |  51 +--
 gcc/testsuite/gfortran.dg/pr120191_1.f90 | 614 +++++++++++++++++++++++++++++++
 2 files changed, 629 insertions(+), 36 deletions(-)

diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc
index 440cbdd19abc..fce5ee28de83 100644
--- a/gcc/fortran/trans-intrinsic.cc
+++ b/gcc/fortran/trans-intrinsic.cc
@@ -4715,22 +4715,6 @@ maybe_absent_optional_variable (gfc_expr *e)
 }
 
 
-/* Remove unneeded kind= argument from actual argument list when the
-   result conversion is dealt with in a different place.  */
-
-static void
-strip_kind_from_actual (gfc_actual_arglist * actual)
-{
-  for (gfc_actual_arglist *a = actual; a; a = a->next)
-    {
-      if (a && a->name && strcmp (a->name, "kind") == 0)
-       {
-         gfc_free_expr (a->expr);
-         a->expr = NULL;
-       }
-    }
-}
-
 /* Emit code for minloc or maxloc intrinsic.  There are many different cases
    we need to handle.  For performance reasons we sometimes create two
    loops instead of one, where the second one is much simpler.
@@ -4925,7 +4909,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * 
expr, enum tree_code op)
   tree b_if, b_else;
   tree back;
   gfc_loopinfo loop, *ploop;
-  gfc_actual_arglist *actual, *array_arg, *dim_arg, *mask_arg, *kind_arg;
+  gfc_actual_arglist *array_arg, *dim_arg, *mask_arg, *kind_arg;
   gfc_actual_arglist *back_arg;
   gfc_ss *arrayss = nullptr;
   gfc_ss *maskss = nullptr;
@@ -4944,8 +4928,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * 
expr, enum tree_code op)
   int n;
   bool optional_mask;
 
-  actual = expr->value.function.actual;
-  array_arg = actual;
+  array_arg = expr->value.function.actual;
   dim_arg = array_arg->next;
   mask_arg = dim_arg->next;
   kind_arg = mask_arg->next;
@@ -4954,14 +4937,16 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * 
expr, enum tree_code op)
   bool dim_present = dim_arg->expr != nullptr;
   bool nested_loop = dim_present && expr->rank > 0;
 
-  /* The last argument, BACK, is passed by value. Ensure that
-     by setting its name to %VAL. */
-  for (gfc_actual_arglist *a = actual; a; a = a->next)
+  /* Remove kind.  */
+  if (kind_arg->expr)
     {
-      if (a->next == NULL)
-       a->name = "%VAL";
+      gfc_free_expr (kind_arg->expr);
+      kind_arg->expr = NULL;
     }
 
+  /* Pass BACK argument by value.  */
+  back_arg->name = "%VAL";
+
   if (se->ss)
     {
       if (se->ss->info->useflags)
@@ -4983,25 +4968,19 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * 
expr, enum tree_code op)
        }
     }
 
-  arrayexpr = actual->expr;
+  arrayexpr = array_arg->expr;
 
-  /* Special case for character maxloc.  Remove unneeded actual
-     arguments, then call a library function.  */
+  /* Special case for character maxloc.  Remove unneeded "dim" actual
+     argument, then call a library function.  */
 
   if (arrayexpr->ts.type == BT_CHARACTER)
     {
       gcc_assert (expr->rank == 0);
 
-      gfc_actual_arglist *a = actual;
-      strip_kind_from_actual (a);
-      while (a)
+      if (dim_arg->expr)
        {
-         if (a->name && strcmp (a->name, "dim") == 0)
-           {
-             gfc_free_expr (a->expr);
-             a->expr = NULL;
-           }
-         a = a->next;
+         gfc_free_expr (dim_arg->expr);
+         dim_arg->expr = NULL;
        }
       gfc_conv_intrinsic_funcall (se, expr);
       return;
diff --git a/gcc/testsuite/gfortran.dg/pr120191_1.f90 
b/gcc/testsuite/gfortran.dg/pr120191_1.f90
new file mode 100644
index 000000000000..13a787d64bb3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr120191_1.f90
@@ -0,0 +1,614 @@
+! PR fortran/120191
+! { dg-do run }
+
+  integer(kind=1) :: a1(10, 10, 10), b1(10)
+  integer(kind=2) :: a2(10, 10, 10), b2(10)
+  integer(kind=4) :: a4(10, 10, 10), b4(10)
+  integer(kind=8) :: a8(10, 10, 10), b8(10)
+  real(kind=4) :: r4(10, 10, 10), s4(10)
+  real(kind=8) :: r8(10, 10, 10), s8(10)
+  logical :: l1(10, 10, 10), l2(10), l3
+  l1 = .true.
+  l2 = .true.
+  l3 = .true.
+  a1 = 0
+  if (any (maxloc (a1) .ne. 1)) stop 1
+  if (any (maxloc (a1, back=.false.) .ne. 1)) stop 2
+  if (any (maxloc (a1, back=.true.) .ne. 10)) stop 3
+  if (any (maxloc (a1, kind=2) .ne. 1)) stop 4
+  if (any (maxloc (a1, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (maxloc (a1, kind=8, back=.true.) .ne. 10)) stop 6
+  if (any (maxloc (a1, 1) .ne. 1)) stop 7
+  if (any (maxloc (a1, 1, back=.false.) .ne. 1)) stop 8
+  if (any (maxloc (a1, 1, back=.true.) .ne. 10)) stop 9
+  if (any (maxloc (a1, 1, kind=1) .ne. 1)) stop 10
+  if (any (maxloc (a1, 1, kind=2, back=.false.) .ne. 1)) stop 11
+  if (any (maxloc (a1, 1, kind=4, back=.true.) .ne. 10)) stop 12
+  if (any (maxloc (a1, 1, l1) .ne. 1)) stop 13
+  if (any (maxloc (a1, 1, l1, back=.false.) .ne. 1)) stop 14
+  if (any (maxloc (a1, 1, l1, back=.true.) .ne. 10)) stop 15
+  if (any (maxloc (a1, 1, l1, kind=8) .ne. 1)) stop 16
+  if (any (maxloc (a1, 1, l1, 4, .false.) .ne. 1)) stop 17
+  if (any (maxloc (a1, 1, l1, 2, .true.) .ne. 10)) stop 18
+  if (any (maxloc (a1, 1, l3) .ne. 1)) stop 19
+  if (any (maxloc (a1, 1, l3, back=.false.) .ne. 1)) stop 20
+  if (any (maxloc (a1, 1, l3, back=.true.) .ne. 10)) stop 21
+  if (any (maxloc (a1, 1, l3, kind=8) .ne. 1)) stop 22
+  if (any (maxloc (a1, 1, l3, 4, .false.) .ne. 1)) stop 23
+  if (any (maxloc (a1, 1, l3, 2, .true.) .ne. 10)) stop 24
+  b1 = 0
+  if (any (maxloc (b1) .ne. 1)) stop 1
+  if (any (maxloc (b1, back=.false.) .ne. 1)) stop 2
+  if (any (maxloc (b1, back=.true.) .ne. 10)) stop 3
+  if (any (maxloc (b1, kind=2) .ne. 1)) stop 4
+  if (any (maxloc (b1, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (maxloc (b1, kind=8, back=.true.) .ne. 10)) stop 6
+  if (maxloc (b1, 1) .ne. 1) stop 7
+  if (maxloc (b1, 1, back=.false.) .ne. 1) stop 8
+  if (maxloc (b1, 1, back=.true.) .ne. 10) stop 9
+  if (maxloc (b1, 1, kind=1) .ne. 1) stop 10
+  if (maxloc (b1, 1, kind=2, back=.false.) .ne. 1) stop 11
+  if (maxloc (b1, 1, kind=4, back=.true.) .ne. 10) stop 12
+  if (maxloc (b1, 1, l2) .ne. 1) stop 13
+  if (maxloc (b1, 1, l2, back=.false.) .ne. 1) stop 14
+  if (maxloc (b1, 1, l2, back=.true.) .ne. 10) stop 15
+  if (maxloc (b1, 1, l2, kind=8) .ne. 1) stop 16
+  if (maxloc (b1, 1, l2, 4, .false.) .ne. 1) stop 17
+  if (maxloc (b1, 1, l2, 2, .true.) .ne. 10) stop 18
+  if (maxloc (b1, 1, l3) .ne. 1) stop 19
+  if (maxloc (b1, 1, l3, back=.false.) .ne. 1) stop 20
+  if (maxloc (b1, 1, l3, back=.true.) .ne. 10) stop 21
+  if (maxloc (b1, 1, l3, kind=8) .ne. 1) stop 22
+  if (maxloc (b1, 1, l3, 4, .false.) .ne. 1) stop 23
+  if (maxloc (b1, 1, l3, 2, .true.) .ne. 10) stop 24
+  a2 = 0
+  if (any (maxloc (a2) .ne. 1)) stop 1
+  if (any (maxloc (a2, back=.false.) .ne. 1)) stop 2
+  if (any (maxloc (a2, back=.true.) .ne. 10)) stop 3
+  if (any (maxloc (a2, kind=2) .ne. 1)) stop 4
+  if (any (maxloc (a2, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (maxloc (a2, kind=8, back=.true.) .ne. 10)) stop 6
+  if (any (maxloc (a2, 1) .ne. 1)) stop 7
+  if (any (maxloc (a2, 1, back=.false.) .ne. 1)) stop 8
+  if (any (maxloc (a2, 1, back=.true.) .ne. 10)) stop 9
+  if (any (maxloc (a2, 1, kind=1) .ne. 1)) stop 10
+  if (any (maxloc (a2, 1, kind=2, back=.false.) .ne. 1)) stop 11
+  if (any (maxloc (a2, 1, kind=4, back=.true.) .ne. 10)) stop 12
+  if (any (maxloc (a2, 1, l1) .ne. 1)) stop 13
+  if (any (maxloc (a2, 1, l1, back=.false.) .ne. 1)) stop 14
+  if (any (maxloc (a2, 1, l1, back=.true.) .ne. 10)) stop 15
+  if (any (maxloc (a2, 1, l1, kind=8) .ne. 1)) stop 16
+  if (any (maxloc (a2, 1, l1, 4, .false.) .ne. 1)) stop 17
+  if (any (maxloc (a2, 1, l1, 2, .true.) .ne. 10)) stop 18
+  if (any (maxloc (a2, 1, l3) .ne. 1)) stop 19
+  if (any (maxloc (a2, 1, l3, back=.false.) .ne. 1)) stop 20
+  if (any (maxloc (a2, 1, l3, back=.true.) .ne. 10)) stop 21
+  if (any (maxloc (a2, 1, l3, kind=8) .ne. 1)) stop 22
+  if (any (maxloc (a2, 1, l3, 4, .false.) .ne. 1)) stop 23
+  if (any (maxloc (a2, 1, l3, 2, .true.) .ne. 10)) stop 24
+  b2 = 0
+  if (any (maxloc (b2) .ne. 1)) stop 1
+  if (any (maxloc (b2, back=.false.) .ne. 1)) stop 2
+  if (any (maxloc (b2, back=.true.) .ne. 10)) stop 3
+  if (any (maxloc (b2, kind=2) .ne. 1)) stop 4
+  if (any (maxloc (b2, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (maxloc (b2, kind=8, back=.true.) .ne. 10)) stop 6
+  if (maxloc (b2, 1) .ne. 1) stop 7
+  if (maxloc (b2, 1, back=.false.) .ne. 1) stop 8
+  if (maxloc (b2, 1, back=.true.) .ne. 10) stop 9
+  if (maxloc (b2, 1, kind=1) .ne. 1) stop 10
+  if (maxloc (b2, 1, kind=2, back=.false.) .ne. 1) stop 11
+  if (maxloc (b2, 1, kind=4, back=.true.) .ne. 10) stop 12
+  if (maxloc (b2, 1, l2) .ne. 1) stop 13
+  if (maxloc (b2, 1, l2, back=.false.) .ne. 1) stop 14
+  if (maxloc (b2, 1, l2, back=.true.) .ne. 10) stop 15
+  if (maxloc (b2, 1, l2, kind=8) .ne. 1) stop 16
+  if (maxloc (b2, 1, l2, 4, .false.) .ne. 1) stop 17
+  if (maxloc (b2, 1, l2, 2, .true.) .ne. 10) stop 18
+  if (maxloc (b2, 1, l3) .ne. 1) stop 19
+  if (maxloc (b2, 1, l3, back=.false.) .ne. 1) stop 20
+  if (maxloc (b2, 1, l3, back=.true.) .ne. 10) stop 21
+  if (maxloc (b2, 1, l3, kind=8) .ne. 1) stop 22
+  if (maxloc (b2, 1, l3, 4, .false.) .ne. 1) stop 23
+  if (maxloc (b2, 1, l3, 2, .true.) .ne. 10) stop 24
+  a4 = 0
+  if (any (maxloc (a4) .ne. 1)) stop 1
+  if (any (maxloc (a4, back=.false.) .ne. 1)) stop 2
+  if (any (maxloc (a4, back=.true.) .ne. 10)) stop 3
+  if (any (maxloc (a4, kind=2) .ne. 1)) stop 4
+  if (any (maxloc (a4, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (maxloc (a4, kind=8, back=.true.) .ne. 10)) stop 6
+  if (any (maxloc (a4, 1) .ne. 1)) stop 7
+  if (any (maxloc (a4, 1, back=.false.) .ne. 1)) stop 8
+  if (any (maxloc (a4, 1, back=.true.) .ne. 10)) stop 9
+  if (any (maxloc (a4, 1, kind=1) .ne. 1)) stop 10
+  if (any (maxloc (a4, 1, kind=2, back=.false.) .ne. 1)) stop 11
+  if (any (maxloc (a4, 1, kind=4, back=.true.) .ne. 10)) stop 12
+  if (any (maxloc (a4, 1, l1) .ne. 1)) stop 13
+  if (any (maxloc (a4, 1, l1, back=.false.) .ne. 1)) stop 14
+  if (any (maxloc (a4, 1, l1, back=.true.) .ne. 10)) stop 15
+  if (any (maxloc (a4, 1, l1, kind=8) .ne. 1)) stop 16
+  if (any (maxloc (a4, 1, l1, 4, .false.) .ne. 1)) stop 17
+  if (any (maxloc (a4, 1, l1, 2, .true.) .ne. 10)) stop 18
+  if (any (maxloc (a4, 1, l3) .ne. 1)) stop 19
+  if (any (maxloc (a4, 1, l3, back=.false.) .ne. 1)) stop 20
+  if (any (maxloc (a4, 1, l3, back=.true.) .ne. 10)) stop 21
+  if (any (maxloc (a4, 1, l3, kind=8) .ne. 1)) stop 22
+  if (any (maxloc (a4, 1, l3, 4, .false.) .ne. 1)) stop 23
+  if (any (maxloc (a4, 1, l3, 2, .true.) .ne. 10)) stop 24
+  b4 = 0
+  if (any (maxloc (b4) .ne. 1)) stop 1
+  if (any (maxloc (b4, back=.false.) .ne. 1)) stop 2
+  if (any (maxloc (b4, back=.true.) .ne. 10)) stop 3
+  if (any (maxloc (b4, kind=2) .ne. 1)) stop 4
+  if (any (maxloc (b4, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (maxloc (b4, kind=8, back=.true.) .ne. 10)) stop 6
+  if (maxloc (b4, 1) .ne. 1) stop 7
+  if (maxloc (b4, 1, back=.false.) .ne. 1) stop 8
+  if (maxloc (b4, 1, back=.true.) .ne. 10) stop 9
+  if (maxloc (b4, 1, kind=1) .ne. 1) stop 10
+  if (maxloc (b4, 1, kind=2, back=.false.) .ne. 1) stop 11
+  if (maxloc (b4, 1, kind=4, back=.true.) .ne. 10) stop 12
+  if (maxloc (b4, 1, l2) .ne. 1) stop 13
+  if (maxloc (b4, 1, l2, back=.false.) .ne. 1) stop 14
+  if (maxloc (b4, 1, l2, back=.true.) .ne. 10) stop 15
+  if (maxloc (b4, 1, l2, kind=8) .ne. 1) stop 16
+  if (maxloc (b4, 1, l2, 4, .false.) .ne. 1) stop 17
+  if (maxloc (b4, 1, l2, 2, .true.) .ne. 10) stop 18
+  if (maxloc (b4, 1, l3) .ne. 1) stop 19
+  if (maxloc (b4, 1, l3, back=.false.) .ne. 1) stop 20
+  if (maxloc (b4, 1, l3, back=.true.) .ne. 10) stop 21
+  if (maxloc (b4, 1, l3, kind=8) .ne. 1) stop 22
+  if (maxloc (b4, 1, l3, 4, .false.) .ne. 1) stop 23
+  if (maxloc (b4, 1, l3, 2, .true.) .ne. 10) stop 24
+  a8 = 0
+  if (any (maxloc (a8) .ne. 1)) stop 1
+  if (any (maxloc (a8, back=.false.) .ne. 1)) stop 2
+  if (any (maxloc (a8, back=.true.) .ne. 10)) stop 3
+  if (any (maxloc (a8, kind=2) .ne. 1)) stop 4
+  if (any (maxloc (a8, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (maxloc (a8, kind=8, back=.true.) .ne. 10)) stop 6
+  if (any (maxloc (a8, 1) .ne. 1)) stop 7
+  if (any (maxloc (a8, 1, back=.false.) .ne. 1)) stop 8
+  if (any (maxloc (a8, 1, back=.true.) .ne. 10)) stop 9
+  if (any (maxloc (a8, 1, kind=1) .ne. 1)) stop 10
+  if (any (maxloc (a8, 1, kind=2, back=.false.) .ne. 1)) stop 11
+  if (any (maxloc (a8, 1, kind=4, back=.true.) .ne. 10)) stop 12
+  if (any (maxloc (a8, 1, l1) .ne. 1)) stop 13
+  if (any (maxloc (a8, 1, l1, back=.false.) .ne. 1)) stop 14
+  if (any (maxloc (a8, 1, l1, back=.true.) .ne. 10)) stop 15
+  if (any (maxloc (a8, 1, l1, kind=8) .ne. 1)) stop 16
+  if (any (maxloc (a8, 1, l1, 4, .false.) .ne. 1)) stop 17
+  if (any (maxloc (a8, 1, l1, 2, .true.) .ne. 10)) stop 18
+  if (any (maxloc (a8, 1, l3) .ne. 1)) stop 19
+  if (any (maxloc (a8, 1, l3, back=.false.) .ne. 1)) stop 20
+  if (any (maxloc (a8, 1, l3, back=.true.) .ne. 10)) stop 21
+  if (any (maxloc (a8, 1, l3, kind=8) .ne. 1)) stop 22
+  if (any (maxloc (a8, 1, l3, 4, .false.) .ne. 1)) stop 23
+  if (any (maxloc (a8, 1, l3, 2, .true.) .ne. 10)) stop 24
+  b8 = 0
+  if (any (maxloc (b8) .ne. 1)) stop 1
+  if (any (maxloc (b8, back=.false.) .ne. 1)) stop 2
+  if (any (maxloc (b8, back=.true.) .ne. 10)) stop 3
+  if (any (maxloc (b8, kind=2) .ne. 1)) stop 4
+  if (any (maxloc (b8, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (maxloc (b8, kind=8, back=.true.) .ne. 10)) stop 6
+  if (maxloc (b8, 1) .ne. 1) stop 7
+  if (maxloc (b8, 1, back=.false.) .ne. 1) stop 8
+  if (maxloc (b8, 1, back=.true.) .ne. 10) stop 9
+  if (maxloc (b8, 1, kind=1) .ne. 1) stop 10
+  if (maxloc (b8, 1, kind=2, back=.false.) .ne. 1) stop 11
+  if (maxloc (b8, 1, kind=4, back=.true.) .ne. 10) stop 12
+  if (maxloc (b8, 1, l2) .ne. 1) stop 13
+  if (maxloc (b8, 1, l2, back=.false.) .ne. 1) stop 14
+  if (maxloc (b8, 1, l2, back=.true.) .ne. 10) stop 15
+  if (maxloc (b8, 1, l2, kind=8) .ne. 1) stop 16
+  if (maxloc (b8, 1, l2, 4, .false.) .ne. 1) stop 17
+  if (maxloc (b8, 1, l2, 2, .true.) .ne. 10) stop 18
+  if (maxloc (b8, 1, l3) .ne. 1) stop 19
+  if (maxloc (b8, 1, l3, back=.false.) .ne. 1) stop 20
+  if (maxloc (b8, 1, l3, back=.true.) .ne. 10) stop 21
+  if (maxloc (b8, 1, l3, kind=8) .ne. 1) stop 22
+  if (maxloc (b8, 1, l3, 4, .false.) .ne. 1) stop 23
+  if (maxloc (b8, 1, l3, 2, .true.) .ne. 10) stop 24
+  r4 = 0.0
+  if (any (maxloc (r4) .ne. 1)) stop 1
+  if (any (maxloc (r4, back=.false.) .ne. 1)) stop 2
+  if (any (maxloc (r4, back=.true.) .ne. 10)) stop 3
+  if (any (maxloc (r4, kind=2) .ne. 1)) stop 4
+  if (any (maxloc (r4, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (maxloc (r4, kind=8, back=.true.) .ne. 10)) stop 6
+  if (any (maxloc (r4, 1) .ne. 1)) stop 7
+  if (any (maxloc (r4, 1, back=.false.) .ne. 1)) stop 8
+  if (any (maxloc (r4, 1, back=.true.) .ne. 10)) stop 9
+  if (any (maxloc (r4, 1, kind=1) .ne. 1)) stop 10
+  if (any (maxloc (r4, 1, kind=2, back=.false.) .ne. 1)) stop 11
+  if (any (maxloc (r4, 1, kind=4, back=.true.) .ne. 10)) stop 12
+  if (any (maxloc (r4, 1, l1) .ne. 1)) stop 13
+  if (any (maxloc (r4, 1, l1, back=.false.) .ne. 1)) stop 14
+  if (any (maxloc (r4, 1, l1, back=.true.) .ne. 10)) stop 15
+  if (any (maxloc (r4, 1, l1, kind=8) .ne. 1)) stop 16
+  if (any (maxloc (r4, 1, l1, 4, .false.) .ne. 1)) stop 17
+  if (any (maxloc (r4, 1, l1, 2, .true.) .ne. 10)) stop 18
+  if (any (maxloc (r4, 1, l3) .ne. 1)) stop 19
+  if (any (maxloc (r4, 1, l3, back=.false.) .ne. 1)) stop 20
+  if (any (maxloc (r4, 1, l3, back=.true.) .ne. 10)) stop 21
+  if (any (maxloc (r4, 1, l3, kind=8) .ne. 1)) stop 22
+  if (any (maxloc (r4, 1, l3, 4, .false.) .ne. 1)) stop 23
+  if (any (maxloc (r4, 1, l3, 2, .true.) .ne. 10)) stop 24
+  s4 = 0.0
+  if (any (maxloc (s4) .ne. 1)) stop 1
+  if (any (maxloc (s4, back=.false.) .ne. 1)) stop 2
+  if (any (maxloc (s4, back=.true.) .ne. 10)) stop 3
+  if (any (maxloc (s4, kind=2) .ne. 1)) stop 4
+  if (any (maxloc (s4, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (maxloc (s4, kind=8, back=.true.) .ne. 10)) stop 6
+  if (maxloc (s4, 1) .ne. 1) stop 7
+  if (maxloc (s4, 1, back=.false.) .ne. 1) stop 8
+  if (maxloc (s4, 1, back=.true.) .ne. 10) stop 9
+  if (maxloc (s4, 1, kind=1) .ne. 1) stop 10
+  if (maxloc (s4, 1, kind=2, back=.false.) .ne. 1) stop 11
+  if (maxloc (s4, 1, kind=4, back=.true.) .ne. 10) stop 12
+  if (maxloc (s4, 1, l2) .ne. 1) stop 13
+  if (maxloc (s4, 1, l2, back=.false.) .ne. 1) stop 14
+  if (maxloc (s4, 1, l2, back=.true.) .ne. 10) stop 15
+  if (maxloc (s4, 1, l2, kind=8) .ne. 1) stop 16
+  if (maxloc (s4, 1, l2, 4, .false.) .ne. 1) stop 17
+  if (maxloc (s4, 1, l2, 2, .true.) .ne. 10) stop 18
+  if (maxloc (s4, 1, l3) .ne. 1) stop 19
+  if (maxloc (s4, 1, l3, back=.false.) .ne. 1) stop 20
+  if (maxloc (s4, 1, l3, back=.true.) .ne. 10) stop 21
+  if (maxloc (s4, 1, l3, kind=8) .ne. 1) stop 22
+  if (maxloc (s4, 1, l3, 4, .false.) .ne. 1) stop 23
+  if (maxloc (s4, 1, l3, 2, .true.) .ne. 10) stop 24
+  r8 = 0.0
+  if (any (maxloc (r8) .ne. 1)) stop 1
+  if (any (maxloc (r8, back=.false.) .ne. 1)) stop 2
+  if (any (maxloc (r8, back=.true.) .ne. 10)) stop 3
+  if (any (maxloc (r8, kind=2) .ne. 1)) stop 4
+  if (any (maxloc (r8, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (maxloc (r8, kind=8, back=.true.) .ne. 10)) stop 6
+  if (any (maxloc (r8, 1) .ne. 1)) stop 7
+  if (any (maxloc (r8, 1, back=.false.) .ne. 1)) stop 8
+  if (any (maxloc (r8, 1, back=.true.) .ne. 10)) stop 9
+  if (any (maxloc (r8, 1, kind=1) .ne. 1)) stop 10
+  if (any (maxloc (r8, 1, kind=2, back=.false.) .ne. 1)) stop 11
+  if (any (maxloc (r8, 1, kind=4, back=.true.) .ne. 10)) stop 12
+  if (any (maxloc (r8, 1, l1) .ne. 1)) stop 13
+  if (any (maxloc (r8, 1, l1, back=.false.) .ne. 1)) stop 14
+  if (any (maxloc (r8, 1, l1, back=.true.) .ne. 10)) stop 15
+  if (any (maxloc (r8, 1, l1, kind=8) .ne. 1)) stop 16
+  if (any (maxloc (r8, 1, l1, 4, .false.) .ne. 1)) stop 17
+  if (any (maxloc (r8, 1, l1, 2, .true.) .ne. 10)) stop 18
+  if (any (maxloc (r8, 1, l3) .ne. 1)) stop 19
+  if (any (maxloc (r8, 1, l3, back=.false.) .ne. 1)) stop 20
+  if (any (maxloc (r8, 1, l3, back=.true.) .ne. 10)) stop 21
+  if (any (maxloc (r8, 1, l3, kind=8) .ne. 1)) stop 22
+  if (any (maxloc (r8, 1, l3, 4, .false.) .ne. 1)) stop 23
+  if (any (maxloc (r8, 1, l3, 2, .true.) .ne. 10)) stop 24
+  s8 = 0.0
+  if (any (maxloc (s8) .ne. 1)) stop 1
+  if (any (maxloc (s8, back=.false.) .ne. 1)) stop 2
+  if (any (maxloc (s8, back=.true.) .ne. 10)) stop 3
+  if (any (maxloc (s8, kind=2) .ne. 1)) stop 4
+  if (any (maxloc (s8, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (maxloc (s8, kind=8, back=.true.) .ne. 10)) stop 6
+  if (maxloc (s8, 1) .ne. 1) stop 7
+  if (maxloc (s8, 1, back=.false.) .ne. 1) stop 8
+  if (maxloc (s8, 1, back=.true.) .ne. 10) stop 9
+  if (maxloc (s8, 1, kind=1) .ne. 1) stop 10
+  if (maxloc (s8, 1, kind=2, back=.false.) .ne. 1) stop 11
+  if (maxloc (s8, 1, kind=4, back=.true.) .ne. 10) stop 12
+  if (maxloc (s8, 1, l2) .ne. 1) stop 13
+  if (maxloc (s8, 1, l2, back=.false.) .ne. 1) stop 14
+  if (maxloc (s8, 1, l2, back=.true.) .ne. 10) stop 15
+  if (maxloc (s8, 1, l2, kind=8) .ne. 1) stop 16
+  if (maxloc (s8, 1, l2, 4, .false.) .ne. 1) stop 17
+  if (maxloc (s8, 1, l2, 2, .true.) .ne. 10) stop 18
+  if (maxloc (s8, 1, l3) .ne. 1) stop 19
+  if (maxloc (s8, 1, l3, back=.false.) .ne. 1) stop 20
+  if (maxloc (s8, 1, l3, back=.true.) .ne. 10) stop 21
+  if (maxloc (s8, 1, l3, kind=8) .ne. 1) stop 22
+  if (maxloc (s8, 1, l3, 4, .false.) .ne. 1) stop 23
+  if (maxloc (s8, 1, l3, 2, .true.) .ne. 10) stop 24
+  a1 = 0
+  if (any (minloc (a1) .ne. 1)) stop 1
+  if (any (minloc (a1, back=.false.) .ne. 1)) stop 2
+  if (any (minloc (a1, back=.true.) .ne. 10)) stop 3
+  if (any (minloc (a1, kind=2) .ne. 1)) stop 4
+  if (any (minloc (a1, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (minloc (a1, kind=8, back=.true.) .ne. 10)) stop 6
+  if (any (minloc (a1, 1) .ne. 1)) stop 7
+  if (any (minloc (a1, 1, back=.false.) .ne. 1)) stop 8
+  if (any (minloc (a1, 1, back=.true.) .ne. 10)) stop 9
+  if (any (minloc (a1, 1, kind=1) .ne. 1)) stop 10
+  if (any (minloc (a1, 1, kind=2, back=.false.) .ne. 1)) stop 11
+  if (any (minloc (a1, 1, kind=4, back=.true.) .ne. 10)) stop 12
+  if (any (minloc (a1, 1, l1) .ne. 1)) stop 13
+  if (any (minloc (a1, 1, l1, back=.false.) .ne. 1)) stop 14
+  if (any (minloc (a1, 1, l1, back=.true.) .ne. 10)) stop 15
+  if (any (minloc (a1, 1, l1, kind=8) .ne. 1)) stop 16
+  if (any (minloc (a1, 1, l1, 4, .false.) .ne. 1)) stop 17
+  if (any (minloc (a1, 1, l1, 2, .true.) .ne. 10)) stop 18
+  if (any (minloc (a1, 1, l3) .ne. 1)) stop 19
+  if (any (minloc (a1, 1, l3, back=.false.) .ne. 1)) stop 20
+  if (any (minloc (a1, 1, l3, back=.true.) .ne. 10)) stop 21
+  if (any (minloc (a1, 1, l3, kind=8) .ne. 1)) stop 22
+  if (any (minloc (a1, 1, l3, 4, .false.) .ne. 1)) stop 23
+  if (any (minloc (a1, 1, l3, 2, .true.) .ne. 10)) stop 24
+  b1 = 0
+  if (any (minloc (b1) .ne. 1)) stop 1
+  if (any (minloc (b1, back=.false.) .ne. 1)) stop 2
+  if (any (minloc (b1, back=.true.) .ne. 10)) stop 3
+  if (any (minloc (b1, kind=2) .ne. 1)) stop 4
+  if (any (minloc (b1, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (minloc (b1, kind=8, back=.true.) .ne. 10)) stop 6
+  if (minloc (b1, 1) .ne. 1) stop 7
+  if (minloc (b1, 1, back=.false.) .ne. 1) stop 8
+  if (minloc (b1, 1, back=.true.) .ne. 10) stop 9
+  if (minloc (b1, 1, kind=1) .ne. 1) stop 10
+  if (minloc (b1, 1, kind=2, back=.false.) .ne. 1) stop 11
+  if (minloc (b1, 1, kind=4, back=.true.) .ne. 10) stop 12
+  if (minloc (b1, 1, l2) .ne. 1) stop 13
+  if (minloc (b1, 1, l2, back=.false.) .ne. 1) stop 14
+  if (minloc (b1, 1, l2, back=.true.) .ne. 10) stop 15
+  if (minloc (b1, 1, l2, kind=8) .ne. 1) stop 16
+  if (minloc (b1, 1, l2, 4, .false.) .ne. 1) stop 17
+  if (minloc (b1, 1, l2, 2, .true.) .ne. 10) stop 18
+  if (minloc (b1, 1, l3) .ne. 1) stop 19
+  if (minloc (b1, 1, l3, back=.false.) .ne. 1) stop 20
+  if (minloc (b1, 1, l3, back=.true.) .ne. 10) stop 21
+  if (minloc (b1, 1, l3, kind=8) .ne. 1) stop 22
+  if (minloc (b1, 1, l3, 4, .false.) .ne. 1) stop 23
+  if (minloc (b1, 1, l3, 2, .true.) .ne. 10) stop 24
+  a2 = 0
+  if (any (minloc (a2) .ne. 1)) stop 1
+  if (any (minloc (a2, back=.false.) .ne. 1)) stop 2
+  if (any (minloc (a2, back=.true.) .ne. 10)) stop 3
+  if (any (minloc (a2, kind=2) .ne. 1)) stop 4
+  if (any (minloc (a2, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (minloc (a2, kind=8, back=.true.) .ne. 10)) stop 6
+  if (any (minloc (a2, 1) .ne. 1)) stop 7
+  if (any (minloc (a2, 1, back=.false.) .ne. 1)) stop 8
+  if (any (minloc (a2, 1, back=.true.) .ne. 10)) stop 9
+  if (any (minloc (a2, 1, kind=1) .ne. 1)) stop 10
+  if (any (minloc (a2, 1, kind=2, back=.false.) .ne. 1)) stop 11
+  if (any (minloc (a2, 1, kind=4, back=.true.) .ne. 10)) stop 12
+  if (any (minloc (a2, 1, l1) .ne. 1)) stop 13
+  if (any (minloc (a2, 1, l1, back=.false.) .ne. 1)) stop 14
+  if (any (minloc (a2, 1, l1, back=.true.) .ne. 10)) stop 15
+  if (any (minloc (a2, 1, l1, kind=8) .ne. 1)) stop 16
+  if (any (minloc (a2, 1, l1, 4, .false.) .ne. 1)) stop 17
+  if (any (minloc (a2, 1, l1, 2, .true.) .ne. 10)) stop 18
+  if (any (minloc (a2, 1, l3) .ne. 1)) stop 19
+  if (any (minloc (a2, 1, l3, back=.false.) .ne. 1)) stop 20
+  if (any (minloc (a2, 1, l3, back=.true.) .ne. 10)) stop 21
+  if (any (minloc (a2, 1, l3, kind=8) .ne. 1)) stop 22
+  if (any (minloc (a2, 1, l3, 4, .false.) .ne. 1)) stop 23
+  if (any (minloc (a2, 1, l3, 2, .true.) .ne. 10)) stop 24
+  b2 = 0
+  if (any (minloc (b2) .ne. 1)) stop 1
+  if (any (minloc (b2, back=.false.) .ne. 1)) stop 2
+  if (any (minloc (b2, back=.true.) .ne. 10)) stop 3
+  if (any (minloc (b2, kind=2) .ne. 1)) stop 4
+  if (any (minloc (b2, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (minloc (b2, kind=8, back=.true.) .ne. 10)) stop 6
+  if (minloc (b2, 1) .ne. 1) stop 7
+  if (minloc (b2, 1, back=.false.) .ne. 1) stop 8
+  if (minloc (b2, 1, back=.true.) .ne. 10) stop 9
+  if (minloc (b2, 1, kind=1) .ne. 1) stop 10
+  if (minloc (b2, 1, kind=2, back=.false.) .ne. 1) stop 11
+  if (minloc (b2, 1, kind=4, back=.true.) .ne. 10) stop 12
+  if (minloc (b2, 1, l2) .ne. 1) stop 13
+  if (minloc (b2, 1, l2, back=.false.) .ne. 1) stop 14
+  if (minloc (b2, 1, l2, back=.true.) .ne. 10) stop 15
+  if (minloc (b2, 1, l2, kind=8) .ne. 1) stop 16
+  if (minloc (b2, 1, l2, 4, .false.) .ne. 1) stop 17
+  if (minloc (b2, 1, l2, 2, .true.) .ne. 10) stop 18
+  if (minloc (b2, 1, l3) .ne. 1) stop 19
+  if (minloc (b2, 1, l3, back=.false.) .ne. 1) stop 20
+  if (minloc (b2, 1, l3, back=.true.) .ne. 10) stop 21
+  if (minloc (b2, 1, l3, kind=8) .ne. 1) stop 22
+  if (minloc (b2, 1, l3, 4, .false.) .ne. 1) stop 23
+  if (minloc (b2, 1, l3, 2, .true.) .ne. 10) stop 24
+  a4 = 0
+  if (any (minloc (a4) .ne. 1)) stop 1
+  if (any (minloc (a4, back=.false.) .ne. 1)) stop 2
+  if (any (minloc (a4, back=.true.) .ne. 10)) stop 3
+  if (any (minloc (a4, kind=2) .ne. 1)) stop 4
+  if (any (minloc (a4, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (minloc (a4, kind=8, back=.true.) .ne. 10)) stop 6
+  if (any (minloc (a4, 1) .ne. 1)) stop 7
+  if (any (minloc (a4, 1, back=.false.) .ne. 1)) stop 8
+  if (any (minloc (a4, 1, back=.true.) .ne. 10)) stop 9
+  if (any (minloc (a4, 1, kind=1) .ne. 1)) stop 10
+  if (any (minloc (a4, 1, kind=2, back=.false.) .ne. 1)) stop 11
+  if (any (minloc (a4, 1, kind=4, back=.true.) .ne. 10)) stop 12
+  if (any (minloc (a4, 1, l1) .ne. 1)) stop 13
+  if (any (minloc (a4, 1, l1, back=.false.) .ne. 1)) stop 14
+  if (any (minloc (a4, 1, l1, back=.true.) .ne. 10)) stop 15
+  if (any (minloc (a4, 1, l1, kind=8) .ne. 1)) stop 16
+  if (any (minloc (a4, 1, l1, 4, .false.) .ne. 1)) stop 17
+  if (any (minloc (a4, 1, l1, 2, .true.) .ne. 10)) stop 18
+  if (any (minloc (a4, 1, l3) .ne. 1)) stop 19
+  if (any (minloc (a4, 1, l3, back=.false.) .ne. 1)) stop 20
+  if (any (minloc (a4, 1, l3, back=.true.) .ne. 10)) stop 21
+  if (any (minloc (a4, 1, l3, kind=8) .ne. 1)) stop 22
+  if (any (minloc (a4, 1, l3, 4, .false.) .ne. 1)) stop 23
+  if (any (minloc (a4, 1, l3, 2, .true.) .ne. 10)) stop 24
+  b4 = 0
+  if (any (minloc (b4) .ne. 1)) stop 1
+  if (any (minloc (b4, back=.false.) .ne. 1)) stop 2
+  if (any (minloc (b4, back=.true.) .ne. 10)) stop 3
+  if (any (minloc (b4, kind=2) .ne. 1)) stop 4
+  if (any (minloc (b4, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (minloc (b4, kind=8, back=.true.) .ne. 10)) stop 6
+  if (minloc (b4, 1) .ne. 1) stop 7
+  if (minloc (b4, 1, back=.false.) .ne. 1) stop 8
+  if (minloc (b4, 1, back=.true.) .ne. 10) stop 9
+  if (minloc (b4, 1, kind=1) .ne. 1) stop 10
+  if (minloc (b4, 1, kind=2, back=.false.) .ne. 1) stop 11
+  if (minloc (b4, 1, kind=4, back=.true.) .ne. 10) stop 12
+  if (minloc (b4, 1, l2) .ne. 1) stop 13
+  if (minloc (b4, 1, l2, back=.false.) .ne. 1) stop 14
+  if (minloc (b4, 1, l2, back=.true.) .ne. 10) stop 15
+  if (minloc (b4, 1, l2, kind=8) .ne. 1) stop 16
+  if (minloc (b4, 1, l2, 4, .false.) .ne. 1) stop 17
+  if (minloc (b4, 1, l2, 2, .true.) .ne. 10) stop 18
+  if (minloc (b4, 1, l3) .ne. 1) stop 19
+  if (minloc (b4, 1, l3, back=.false.) .ne. 1) stop 20
+  if (minloc (b4, 1, l3, back=.true.) .ne. 10) stop 21
+  if (minloc (b4, 1, l3, kind=8) .ne. 1) stop 22
+  if (minloc (b4, 1, l3, 4, .false.) .ne. 1) stop 23
+  if (minloc (b4, 1, l3, 2, .true.) .ne. 10) stop 24
+  a8 = 0
+  if (any (minloc (a8) .ne. 1)) stop 1
+  if (any (minloc (a8, back=.false.) .ne. 1)) stop 2
+  if (any (minloc (a8, back=.true.) .ne. 10)) stop 3
+  if (any (minloc (a8, kind=2) .ne. 1)) stop 4
+  if (any (minloc (a8, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (minloc (a8, kind=8, back=.true.) .ne. 10)) stop 6
+  if (any (minloc (a8, 1) .ne. 1)) stop 7
+  if (any (minloc (a8, 1, back=.false.) .ne. 1)) stop 8
+  if (any (minloc (a8, 1, back=.true.) .ne. 10)) stop 9
+  if (any (minloc (a8, 1, kind=1) .ne. 1)) stop 10
+  if (any (minloc (a8, 1, kind=2, back=.false.) .ne. 1)) stop 11
+  if (any (minloc (a8, 1, kind=4, back=.true.) .ne. 10)) stop 12
+  if (any (minloc (a8, 1, l1) .ne. 1)) stop 13
+  if (any (minloc (a8, 1, l1, back=.false.) .ne. 1)) stop 14
+  if (any (minloc (a8, 1, l1, back=.true.) .ne. 10)) stop 15
+  if (any (minloc (a8, 1, l1, kind=8) .ne. 1)) stop 16
+  if (any (minloc (a8, 1, l1, 4, .false.) .ne. 1)) stop 17
+  if (any (minloc (a8, 1, l1, 2, .true.) .ne. 10)) stop 18
+  if (any (minloc (a8, 1, l3) .ne. 1)) stop 19
+  if (any (minloc (a8, 1, l3, back=.false.) .ne. 1)) stop 20
+  if (any (minloc (a8, 1, l3, back=.true.) .ne. 10)) stop 21
+  if (any (minloc (a8, 1, l3, kind=8) .ne. 1)) stop 22
+  if (any (minloc (a8, 1, l3, 4, .false.) .ne. 1)) stop 23
+  if (any (minloc (a8, 1, l3, 2, .true.) .ne. 10)) stop 24
+  b8 = 0
+  if (any (minloc (b8) .ne. 1)) stop 1
+  if (any (minloc (b8, back=.false.) .ne. 1)) stop 2
+  if (any (minloc (b8, back=.true.) .ne. 10)) stop 3
+  if (any (minloc (b8, kind=2) .ne. 1)) stop 4
+  if (any (minloc (b8, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (minloc (b8, kind=8, back=.true.) .ne. 10)) stop 6
+  if (minloc (b8, 1) .ne. 1) stop 7
+  if (minloc (b8, 1, back=.false.) .ne. 1) stop 8
+  if (minloc (b8, 1, back=.true.) .ne. 10) stop 9
+  if (minloc (b8, 1, kind=1) .ne. 1) stop 10
+  if (minloc (b8, 1, kind=2, back=.false.) .ne. 1) stop 11
+  if (minloc (b8, 1, kind=4, back=.true.) .ne. 10) stop 12
+  if (minloc (b8, 1, l2) .ne. 1) stop 13
+  if (minloc (b8, 1, l2, back=.false.) .ne. 1) stop 14
+  if (minloc (b8, 1, l2, back=.true.) .ne. 10) stop 15
+  if (minloc (b8, 1, l2, kind=8) .ne. 1) stop 16
+  if (minloc (b8, 1, l2, 4, .false.) .ne. 1) stop 17
+  if (minloc (b8, 1, l2, 2, .true.) .ne. 10) stop 18
+  if (minloc (b8, 1, l3) .ne. 1) stop 19
+  if (minloc (b8, 1, l3, back=.false.) .ne. 1) stop 20
+  if (minloc (b8, 1, l3, back=.true.) .ne. 10) stop 21
+  if (minloc (b8, 1, l3, kind=8) .ne. 1) stop 22
+  if (minloc (b8, 1, l3, 4, .false.) .ne. 1) stop 23
+  if (minloc (b8, 1, l3, 2, .true.) .ne. 10) stop 24
+  r4 = 0.0
+  if (any (minloc (r4) .ne. 1)) stop 1
+  if (any (minloc (r4, back=.false.) .ne. 1)) stop 2
+  if (any (minloc (r4, back=.true.) .ne. 10)) stop 3
+  if (any (minloc (r4, kind=2) .ne. 1)) stop 4
+  if (any (minloc (r4, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (minloc (r4, kind=8, back=.true.) .ne. 10)) stop 6
+  if (any (minloc (r4, 1) .ne. 1)) stop 7
+  if (any (minloc (r4, 1, back=.false.) .ne. 1)) stop 8
+  if (any (minloc (r4, 1, back=.true.) .ne. 10)) stop 9
+  if (any (minloc (r4, 1, kind=1) .ne. 1)) stop 10
+  if (any (minloc (r4, 1, kind=2, back=.false.) .ne. 1)) stop 11
+  if (any (minloc (r4, 1, kind=4, back=.true.) .ne. 10)) stop 12
+  if (any (minloc (r4, 1, l1) .ne. 1)) stop 13
+  if (any (minloc (r4, 1, l1, back=.false.) .ne. 1)) stop 14
+  if (any (minloc (r4, 1, l1, back=.true.) .ne. 10)) stop 15
+  if (any (minloc (r4, 1, l1, kind=8) .ne. 1)) stop 16
+  if (any (minloc (r4, 1, l1, 4, .false.) .ne. 1)) stop 17
+  if (any (minloc (r4, 1, l1, 2, .true.) .ne. 10)) stop 18
+  if (any (minloc (r4, 1, l3) .ne. 1)) stop 19
+  if (any (minloc (r4, 1, l3, back=.false.) .ne. 1)) stop 20
+  if (any (minloc (r4, 1, l3, back=.true.) .ne. 10)) stop 21
+  if (any (minloc (r4, 1, l3, kind=8) .ne. 1)) stop 22
+  if (any (minloc (r4, 1, l3, 4, .false.) .ne. 1)) stop 23
+  if (any (minloc (r4, 1, l3, 2, .true.) .ne. 10)) stop 24
+  s4 = 0.0
+  if (any (minloc (s4) .ne. 1)) stop 1
+  if (any (minloc (s4, back=.false.) .ne. 1)) stop 2
+  if (any (minloc (s4, back=.true.) .ne. 10)) stop 3
+  if (any (minloc (s4, kind=2) .ne. 1)) stop 4
+  if (any (minloc (s4, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (minloc (s4, kind=8, back=.true.) .ne. 10)) stop 6
+  if (minloc (s4, 1) .ne. 1) stop 7
+  if (minloc (s4, 1, back=.false.) .ne. 1) stop 8
+  if (minloc (s4, 1, back=.true.) .ne. 10) stop 9
+  if (minloc (s4, 1, kind=1) .ne. 1) stop 10
+  if (minloc (s4, 1, kind=2, back=.false.) .ne. 1) stop 11
+  if (minloc (s4, 1, kind=4, back=.true.) .ne. 10) stop 12
+  if (minloc (s4, 1, l2) .ne. 1) stop 13
+  if (minloc (s4, 1, l2, back=.false.) .ne. 1) stop 14
+  if (minloc (s4, 1, l2, back=.true.) .ne. 10) stop 15
+  if (minloc (s4, 1, l2, kind=8) .ne. 1) stop 16
+  if (minloc (s4, 1, l2, 4, .false.) .ne. 1) stop 17
+  if (minloc (s4, 1, l2, 2, .true.) .ne. 10) stop 18
+  if (minloc (s4, 1, l3) .ne. 1) stop 19
+  if (minloc (s4, 1, l3, back=.false.) .ne. 1) stop 20
+  if (minloc (s4, 1, l3, back=.true.) .ne. 10) stop 21
+  if (minloc (s4, 1, l3, kind=8) .ne. 1) stop 22
+  if (minloc (s4, 1, l3, 4, .false.) .ne. 1) stop 23
+  if (minloc (s4, 1, l3, 2, .true.) .ne. 10) stop 24
+  r8 = 0.0
+  if (any (minloc (r8) .ne. 1)) stop 1
+  if (any (minloc (r8, back=.false.) .ne. 1)) stop 2
+  if (any (minloc (r8, back=.true.) .ne. 10)) stop 3
+  if (any (minloc (r8, kind=2) .ne. 1)) stop 4
+  if (any (minloc (r8, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (minloc (r8, kind=8, back=.true.) .ne. 10)) stop 6
+  if (any (minloc (r8, 1) .ne. 1)) stop 7
+  if (any (minloc (r8, 1, back=.false.) .ne. 1)) stop 8
+  if (any (minloc (r8, 1, back=.true.) .ne. 10)) stop 9
+  if (any (minloc (r8, 1, kind=1) .ne. 1)) stop 10
+  if (any (minloc (r8, 1, kind=2, back=.false.) .ne. 1)) stop 11
+  if (any (minloc (r8, 1, kind=4, back=.true.) .ne. 10)) stop 12
+  if (any (minloc (r8, 1, l1) .ne. 1)) stop 13
+  if (any (minloc (r8, 1, l1, back=.false.) .ne. 1)) stop 14
+  if (any (minloc (r8, 1, l1, back=.true.) .ne. 10)) stop 15
+  if (any (minloc (r8, 1, l1, kind=8) .ne. 1)) stop 16
+  if (any (minloc (r8, 1, l1, 4, .false.) .ne. 1)) stop 17
+  if (any (minloc (r8, 1, l1, 2, .true.) .ne. 10)) stop 18
+  if (any (minloc (r8, 1, l3) .ne. 1)) stop 19
+  if (any (minloc (r8, 1, l3, back=.false.) .ne. 1)) stop 20
+  if (any (minloc (r8, 1, l3, back=.true.) .ne. 10)) stop 21
+  if (any (minloc (r8, 1, l3, kind=8) .ne. 1)) stop 22
+  if (any (minloc (r8, 1, l3, 4, .false.) .ne. 1)) stop 23
+  if (any (minloc (r8, 1, l3, 2, .true.) .ne. 10)) stop 24
+  s8 = 0.0
+  if (any (minloc (s8) .ne. 1)) stop 1
+  if (any (minloc (s8, back=.false.) .ne. 1)) stop 2
+  if (any (minloc (s8, back=.true.) .ne. 10)) stop 3
+  if (any (minloc (s8, kind=2) .ne. 1)) stop 4
+  if (any (minloc (s8, kind=4, back=.false.) .ne. 1)) stop 5
+  if (any (minloc (s8, kind=8, back=.true.) .ne. 10)) stop 6
+  if (minloc (s8, 1) .ne. 1) stop 7
+  if (minloc (s8, 1, back=.false.) .ne. 1) stop 8
+  if (minloc (s8, 1, back=.true.) .ne. 10) stop 9
+  if (minloc (s8, 1, kind=1) .ne. 1) stop 10
+  if (minloc (s8, 1, kind=2, back=.false.) .ne. 1) stop 11
+  if (minloc (s8, 1, kind=4, back=.true.) .ne. 10) stop 12
+  if (minloc (s8, 1, l2) .ne. 1) stop 13
+  if (minloc (s8, 1, l2, back=.false.) .ne. 1) stop 14
+  if (minloc (s8, 1, l2, back=.true.) .ne. 10) stop 15
+  if (minloc (s8, 1, l2, kind=8) .ne. 1) stop 16
+  if (minloc (s8, 1, l2, 4, .false.) .ne. 1) stop 17
+  if (minloc (s8, 1, l2, 2, .true.) .ne. 10) stop 18
+  if (minloc (s8, 1, l3) .ne. 1) stop 19
+  if (minloc (s8, 1, l3, back=.false.) .ne. 1) stop 20
+  if (minloc (s8, 1, l3, back=.true.) .ne. 10) stop 21
+  if (minloc (s8, 1, l3, kind=8) .ne. 1) stop 22
+  if (minloc (s8, 1, l3, 4, .false.) .ne. 1) stop 23
+  if (minloc (s8, 1, l3, 2, .true.) .ne. 10) stop 24
+end

Reply via email to