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

commit r15-11651-ga5c4366821c22549300e7d28b719400befcb2424
Author: Harald Anlauf <[email protected]>
Date:   Tue Oct 13 20:46:28 2026 +0200

    fortran: Fix MINLOC/MAXLOC with MASK and BACK=.true. [PR127846]
    
    The runtime library templates for MINLOC/MAXLOC did not advance properly
    through the array argument when MASK was present and BACK was .true. .
    
    Co-authored-by: Federico Perini <[email protected]>
    
            PR fortran/127846
    
    libgfortran/ChangeLog:
    
            * generated/maxloc0_16_i1.c (mmaxloc0_16_i1): Regenerate.
            * generated/maxloc0_16_i16.c (mmaxloc0_16_i16): Likewise.
            * generated/maxloc0_16_i2.c (mmaxloc0_16_i2): Likewise.
            * generated/maxloc0_16_i4.c (mmaxloc0_16_i4): Likewise.
            * generated/maxloc0_16_i8.c (mmaxloc0_16_i8): Likewise.
            * generated/maxloc0_16_m1.c (mmaxloc0_16_m1): Likewise.
            * generated/maxloc0_16_m16.c (mmaxloc0_16_m16): Likewise.
            * generated/maxloc0_16_m2.c (mmaxloc0_16_m2): Likewise.
            * generated/maxloc0_16_m4.c (mmaxloc0_16_m4): Likewise.
            * generated/maxloc0_16_m8.c (mmaxloc0_16_m8): Likewise.
            * generated/maxloc0_16_r10.c (mmaxloc0_16_r10): Likewise.
            * generated/maxloc0_16_r16.c (mmaxloc0_16_r16): Likewise.
            * generated/maxloc0_16_r17.c (mmaxloc0_16_r17): Likewise.
            * generated/maxloc0_16_r4.c (mmaxloc0_16_r4): Likewise.
            * generated/maxloc0_16_r8.c (mmaxloc0_16_r8): Likewise.
            * generated/maxloc0_4_i1.c (mmaxloc0_4_i1): Likewise.
            * generated/maxloc0_4_i16.c (mmaxloc0_4_i16): Likewise.
            * generated/maxloc0_4_i2.c (mmaxloc0_4_i2): Likewise.
            * generated/maxloc0_4_i4.c (mmaxloc0_4_i4): Likewise.
            * generated/maxloc0_4_i8.c (mmaxloc0_4_i8): Likewise.
            * generated/maxloc0_4_m1.c (mmaxloc0_4_m1): Likewise.
            * generated/maxloc0_4_m16.c (mmaxloc0_4_m16): Likewise.
            * generated/maxloc0_4_m2.c (mmaxloc0_4_m2): Likewise.
            * generated/maxloc0_4_m4.c (mmaxloc0_4_m4): Likewise.
            * generated/maxloc0_4_m8.c (mmaxloc0_4_m8): Likewise.
            * generated/maxloc0_4_r10.c (mmaxloc0_4_r10): Likewise.
            * generated/maxloc0_4_r16.c (mmaxloc0_4_r16): Likewise.
            * generated/maxloc0_4_r17.c (mmaxloc0_4_r17): Likewise.
            * generated/maxloc0_4_r4.c (mmaxloc0_4_r4): Likewise.
            * generated/maxloc0_4_r8.c (mmaxloc0_4_r8): Likewise.
            * generated/maxloc0_8_i1.c (mmaxloc0_8_i1): Likewise.
            * generated/maxloc0_8_i16.c (mmaxloc0_8_i16): Likewise.
            * generated/maxloc0_8_i2.c (mmaxloc0_8_i2): Likewise.
            * generated/maxloc0_8_i4.c (mmaxloc0_8_i4): Likewise.
            * generated/maxloc0_8_i8.c (mmaxloc0_8_i8): Likewise.
            * generated/maxloc0_8_m1.c (mmaxloc0_8_m1): Likewise.
            * generated/maxloc0_8_m16.c (mmaxloc0_8_m16): Likewise.
            * generated/maxloc0_8_m2.c (mmaxloc0_8_m2): Likewise.
            * generated/maxloc0_8_m4.c (mmaxloc0_8_m4): Likewise.
            * generated/maxloc0_8_m8.c (mmaxloc0_8_m8): Likewise.
            * generated/maxloc0_8_r10.c (mmaxloc0_8_r10): Likewise.
            * generated/maxloc0_8_r16.c (mmaxloc0_8_r16): Likewise.
            * generated/maxloc0_8_r17.c (mmaxloc0_8_r17): Likewise.
            * generated/maxloc0_8_r4.c (mmaxloc0_8_r4): Likewise.
            * generated/maxloc0_8_r8.c (mmaxloc0_8_r8): Likewise.
            * generated/minloc0_16_i1.c (mminloc0_16_i1): Likewise.
            * generated/minloc0_16_i16.c (mminloc0_16_i16): Likewise.
            * generated/minloc0_16_i2.c (mminloc0_16_i2): Likewise.
            * generated/minloc0_16_i4.c (mminloc0_16_i4): Likewise.
            * generated/minloc0_16_i8.c (mminloc0_16_i8): Likewise.
            * generated/minloc0_16_m1.c (mminloc0_16_m1): Likewise.
            * generated/minloc0_16_m16.c (mminloc0_16_m16): Likewise.
            * generated/minloc0_16_m2.c (mminloc0_16_m2): Likewise.
            * generated/minloc0_16_m4.c (mminloc0_16_m4): Likewise.
            * generated/minloc0_16_m8.c (mminloc0_16_m8): Likewise.
            * generated/minloc0_16_r10.c (mminloc0_16_r10): Likewise.
            * generated/minloc0_16_r16.c (mminloc0_16_r16): Likewise.
            * generated/minloc0_16_r17.c (mminloc0_16_r17): Likewise.
            * generated/minloc0_16_r4.c (mminloc0_16_r4): Likewise.
            * generated/minloc0_16_r8.c (mminloc0_16_r8): Likewise.
            * generated/minloc0_4_i1.c (mminloc0_4_i1): Likewise.
            * generated/minloc0_4_i16.c (mminloc0_4_i16): Likewise.
            * generated/minloc0_4_i2.c (mminloc0_4_i2): Likewise.
            * generated/minloc0_4_i4.c (mminloc0_4_i4): Likewise.
            * generated/minloc0_4_i8.c (mminloc0_4_i8): Likewise.
            * generated/minloc0_4_m1.c (mminloc0_4_m1): Likewise.
            * generated/minloc0_4_m16.c (mminloc0_4_m16): Likewise.
            * generated/minloc0_4_m2.c (mminloc0_4_m2): Likewise.
            * generated/minloc0_4_m4.c (mminloc0_4_m4): Likewise.
            * generated/minloc0_4_m8.c (mminloc0_4_m8): Likewise.
            * generated/minloc0_4_r10.c (mminloc0_4_r10): Likewise.
            * generated/minloc0_4_r16.c (mminloc0_4_r16): Likewise.
            * generated/minloc0_4_r17.c (mminloc0_4_r17): Likewise.
            * generated/minloc0_4_r4.c (mminloc0_4_r4): Likewise.
            * generated/minloc0_4_r8.c (mminloc0_4_r8): Likewise.
            * generated/minloc0_8_i1.c (mminloc0_8_i1): Likewise.
            * generated/minloc0_8_i16.c (mminloc0_8_i16): Likewise.
            * generated/minloc0_8_i2.c (mminloc0_8_i2): Likewise.
            * generated/minloc0_8_i4.c (mminloc0_8_i4): Likewise.
            * generated/minloc0_8_i8.c (mminloc0_8_i8): Likewise.
            * generated/minloc0_8_m1.c (mminloc0_8_m1): Likewise.
            * generated/minloc0_8_m16.c (mminloc0_8_m16): Likewise.
            * generated/minloc0_8_m2.c (mminloc0_8_m2): Likewise.
            * generated/minloc0_8_m4.c (mminloc0_8_m4): Likewise.
            * generated/minloc0_8_m8.c (mminloc0_8_m8): Likewise.
            * generated/minloc0_8_r10.c (mminloc0_8_r10): Likewise.
            * generated/minloc0_8_r16.c (mminloc0_8_r16): Likewise.
            * generated/minloc0_8_r17.c (mminloc0_8_r17): Likewise.
            * generated/minloc0_8_r4.c (mminloc0_8_r4): Likewise.
            * generated/minloc0_8_r8.c (mminloc0_8_r8): Likewise.
            * m4/maxloc0.m4: Fix looping through array argument when BACK=.true.
            * m4/minloc0.m4: Likewise.
    
    gcc/testsuite/ChangeLog:
    
            * gfortran.dg/minmaxloc_mask_back.f90: New test.
    
    (cherry picked from commit 9d3a1bc203a79ff547c92ad0fc0773bf328aeeb5)

Diff:
---
 gcc/testsuite/gfortran.dg/minmaxloc_mask_back.f90 | 32 +++++++++++++++++++++++
 libgfortran/generated/maxloc0_16_i1.c             |  2 +-
 libgfortran/generated/maxloc0_16_i16.c            |  2 +-
 libgfortran/generated/maxloc0_16_i2.c             |  2 +-
 libgfortran/generated/maxloc0_16_i4.c             |  2 +-
 libgfortran/generated/maxloc0_16_i8.c             |  2 +-
 libgfortran/generated/maxloc0_16_m1.c             |  2 +-
 libgfortran/generated/maxloc0_16_m16.c            |  2 +-
 libgfortran/generated/maxloc0_16_m2.c             |  2 +-
 libgfortran/generated/maxloc0_16_m4.c             |  2 +-
 libgfortran/generated/maxloc0_16_m8.c             |  2 +-
 libgfortran/generated/maxloc0_16_r10.c            |  2 +-
 libgfortran/generated/maxloc0_16_r16.c            |  2 +-
 libgfortran/generated/maxloc0_16_r17.c            |  2 +-
 libgfortran/generated/maxloc0_16_r4.c             |  2 +-
 libgfortran/generated/maxloc0_16_r8.c             |  2 +-
 libgfortran/generated/maxloc0_4_i1.c              |  2 +-
 libgfortran/generated/maxloc0_4_i16.c             |  2 +-
 libgfortran/generated/maxloc0_4_i2.c              |  2 +-
 libgfortran/generated/maxloc0_4_i4.c              |  2 +-
 libgfortran/generated/maxloc0_4_i8.c              |  2 +-
 libgfortran/generated/maxloc0_4_m1.c              |  2 +-
 libgfortran/generated/maxloc0_4_m16.c             |  2 +-
 libgfortran/generated/maxloc0_4_m2.c              |  2 +-
 libgfortran/generated/maxloc0_4_m4.c              |  2 +-
 libgfortran/generated/maxloc0_4_m8.c              |  2 +-
 libgfortran/generated/maxloc0_4_r10.c             |  2 +-
 libgfortran/generated/maxloc0_4_r16.c             |  2 +-
 libgfortran/generated/maxloc0_4_r17.c             |  2 +-
 libgfortran/generated/maxloc0_4_r4.c              |  2 +-
 libgfortran/generated/maxloc0_4_r8.c              |  2 +-
 libgfortran/generated/maxloc0_8_i1.c              |  2 +-
 libgfortran/generated/maxloc0_8_i16.c             |  2 +-
 libgfortran/generated/maxloc0_8_i2.c              |  2 +-
 libgfortran/generated/maxloc0_8_i4.c              |  2 +-
 libgfortran/generated/maxloc0_8_i8.c              |  2 +-
 libgfortran/generated/maxloc0_8_m1.c              |  2 +-
 libgfortran/generated/maxloc0_8_m16.c             |  2 +-
 libgfortran/generated/maxloc0_8_m2.c              |  2 +-
 libgfortran/generated/maxloc0_8_m4.c              |  2 +-
 libgfortran/generated/maxloc0_8_m8.c              |  2 +-
 libgfortran/generated/maxloc0_8_r10.c             |  2 +-
 libgfortran/generated/maxloc0_8_r16.c             |  2 +-
 libgfortran/generated/maxloc0_8_r17.c             |  2 +-
 libgfortran/generated/maxloc0_8_r4.c              |  2 +-
 libgfortran/generated/maxloc0_8_r8.c              |  2 +-
 libgfortran/generated/minloc0_16_i1.c             |  5 ++--
 libgfortran/generated/minloc0_16_i16.c            |  5 ++--
 libgfortran/generated/minloc0_16_i2.c             |  5 ++--
 libgfortran/generated/minloc0_16_i4.c             |  5 ++--
 libgfortran/generated/minloc0_16_i8.c             |  5 ++--
 libgfortran/generated/minloc0_16_m1.c             |  5 ++--
 libgfortran/generated/minloc0_16_m16.c            |  5 ++--
 libgfortran/generated/minloc0_16_m2.c             |  5 ++--
 libgfortran/generated/minloc0_16_m4.c             |  5 ++--
 libgfortran/generated/minloc0_16_m8.c             |  5 ++--
 libgfortran/generated/minloc0_16_r10.c            |  5 ++--
 libgfortran/generated/minloc0_16_r16.c            |  5 ++--
 libgfortran/generated/minloc0_16_r17.c            |  5 ++--
 libgfortran/generated/minloc0_16_r4.c             |  5 ++--
 libgfortran/generated/minloc0_16_r8.c             |  5 ++--
 libgfortran/generated/minloc0_4_i1.c              |  5 ++--
 libgfortran/generated/minloc0_4_i16.c             |  5 ++--
 libgfortran/generated/minloc0_4_i2.c              |  5 ++--
 libgfortran/generated/minloc0_4_i4.c              |  5 ++--
 libgfortran/generated/minloc0_4_i8.c              |  5 ++--
 libgfortran/generated/minloc0_4_m1.c              |  5 ++--
 libgfortran/generated/minloc0_4_m16.c             |  5 ++--
 libgfortran/generated/minloc0_4_m2.c              |  5 ++--
 libgfortran/generated/minloc0_4_m4.c              |  5 ++--
 libgfortran/generated/minloc0_4_m8.c              |  5 ++--
 libgfortran/generated/minloc0_4_r10.c             |  5 ++--
 libgfortran/generated/minloc0_4_r16.c             |  5 ++--
 libgfortran/generated/minloc0_4_r17.c             |  5 ++--
 libgfortran/generated/minloc0_4_r4.c              |  5 ++--
 libgfortran/generated/minloc0_4_r8.c              |  5 ++--
 libgfortran/generated/minloc0_8_i1.c              |  5 ++--
 libgfortran/generated/minloc0_8_i16.c             |  5 ++--
 libgfortran/generated/minloc0_8_i2.c              |  5 ++--
 libgfortran/generated/minloc0_8_i4.c              |  5 ++--
 libgfortran/generated/minloc0_8_i8.c              |  5 ++--
 libgfortran/generated/minloc0_8_m1.c              |  5 ++--
 libgfortran/generated/minloc0_8_m16.c             |  5 ++--
 libgfortran/generated/minloc0_8_m2.c              |  5 ++--
 libgfortran/generated/minloc0_8_m4.c              |  5 ++--
 libgfortran/generated/minloc0_8_m8.c              |  5 ++--
 libgfortran/generated/minloc0_8_r10.c             |  5 ++--
 libgfortran/generated/minloc0_8_r16.c             |  5 ++--
 libgfortran/generated/minloc0_8_r17.c             |  5 ++--
 libgfortran/generated/minloc0_8_r4.c              |  5 ++--
 libgfortran/generated/minloc0_8_r8.c              |  5 ++--
 libgfortran/m4/maxloc0.m4                         |  2 +-
 libgfortran/m4/minloc0.m4                         |  5 ++--
 93 files changed, 216 insertions(+), 138 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/minmaxloc_mask_back.f90 
b/gcc/testsuite/gfortran.dg/minmaxloc_mask_back.f90
new file mode 100644
index 000000000000..5d02376ccc2e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/minmaxloc_mask_back.f90
@@ -0,0 +1,32 @@
+! { dg-do run }
+!
+! PR fortran/127846 - MINLOC/MAXLOC with MASK and BACK=.true.
+!
+! Contributed by Federico Perini.
+
+program minloc_mask_back
+  implicit none
+  real(8) :: y(3,4)
+  logical :: m(3,4)
+  integer :: i, j, l
+  l = 0
+  do j = 1, 4; do i = 1, 3
+     y(i,j) = real(mod(l*7,5)+1, 8); m(i,j) = mod(l,3) /= 1; l = l + 1
+  end do; end do
+  if (any (minloc(y, mask=m, back=.true.) /= [ 3, 2 ])) then
+     do i = 1, 3
+        print '(4f4.1,6x,4l2)', y(i,:), m(i,:)
+     end do
+     print '(a,2i3,a)', 'minloc(y, mask=m, back=.true.) =', &
+          minloc(y, mask=m, back=.true.), '   expected  3  2 (m(2,4) is F)'
+     stop 1
+  end if
+  if (any (maxloc(y, mask=m, back=.true.) /= [ 3, 1 ])) then
+     do i = 1, 3
+        print '(4f4.1,6x,4l2)', y(i,:), m(i,:)
+     end do
+     print '(a,2i3,a)', 'maxloc(y, mask=m, back=.true.) =', &
+          maxloc(y, mask=m, back=.true.), '   expected  3  1 (m(2,3) is F)'
+     stop 2
+  end if
+end program minloc_mask_back
diff --git a/libgfortran/generated/maxloc0_16_i1.c 
b/libgfortran/generated/maxloc0_16_i1.c
index 770238a41ab2..f3a1975331aa 100644
--- a/libgfortran/generated/maxloc0_16_i1.c
+++ b/libgfortran/generated/maxloc0_16_i1.c
@@ -315,6 +315,7 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_i1 (gfc_array_i16 * const restrict, 
        gfc_array_i1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_i1);
diff --git a/libgfortran/generated/maxloc0_16_i16.c 
b/libgfortran/generated/maxloc0_16_i16.c
index c0e553435107..c5cce960fe65 100644
--- a/libgfortran/generated/maxloc0_16_i16.c
+++ b/libgfortran/generated/maxloc0_16_i16.c
@@ -315,6 +315,7 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_i16 (gfc_array_i16 * const restrict, 
        gfc_array_i16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_i16);
diff --git a/libgfortran/generated/maxloc0_16_i2.c 
b/libgfortran/generated/maxloc0_16_i2.c
index 3d37f3ac98a3..fe7d8b752d02 100644
--- a/libgfortran/generated/maxloc0_16_i2.c
+++ b/libgfortran/generated/maxloc0_16_i2.c
@@ -315,6 +315,7 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_i2 (gfc_array_i16 * const restrict, 
        gfc_array_i2 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_i2);
diff --git a/libgfortran/generated/maxloc0_16_i4.c 
b/libgfortran/generated/maxloc0_16_i4.c
index 0efc69b2ec47..d65a8741d62e 100644
--- a/libgfortran/generated/maxloc0_16_i4.c
+++ b/libgfortran/generated/maxloc0_16_i4.c
@@ -315,6 +315,7 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_i4 (gfc_array_i16 * const restrict, 
        gfc_array_i4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_i4);
diff --git a/libgfortran/generated/maxloc0_16_i8.c 
b/libgfortran/generated/maxloc0_16_i8.c
index d7267103d5b0..6e18b5109fa8 100644
--- a/libgfortran/generated/maxloc0_16_i8.c
+++ b/libgfortran/generated/maxloc0_16_i8.c
@@ -315,6 +315,7 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_i8 (gfc_array_i16 * const restrict, 
        gfc_array_i8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_i8);
diff --git a/libgfortran/generated/maxloc0_16_m1.c 
b/libgfortran/generated/maxloc0_16_m1.c
index 2a47b9ebc125..82f009a738cc 100644
--- a/libgfortran/generated/maxloc0_16_m1.c
+++ b/libgfortran/generated/maxloc0_16_m1.c
@@ -315,6 +315,7 @@ mmaxloc0_16_m1 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_m1 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_m1 (gfc_array_i16 * const restrict, 
        gfc_array_m1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_m1);
diff --git a/libgfortran/generated/maxloc0_16_m16.c 
b/libgfortran/generated/maxloc0_16_m16.c
index 1003fdb7251a..666097306129 100644
--- a/libgfortran/generated/maxloc0_16_m16.c
+++ b/libgfortran/generated/maxloc0_16_m16.c
@@ -315,6 +315,7 @@ mmaxloc0_16_m16 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_m16 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_m16 (gfc_array_i16 * const restrict, 
        gfc_array_m16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_m16);
diff --git a/libgfortran/generated/maxloc0_16_m2.c 
b/libgfortran/generated/maxloc0_16_m2.c
index 49b92f7eb98d..413e2e0cbf18 100644
--- a/libgfortran/generated/maxloc0_16_m2.c
+++ b/libgfortran/generated/maxloc0_16_m2.c
@@ -315,6 +315,7 @@ mmaxloc0_16_m2 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_m2 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_m2 (gfc_array_i16 * const restrict, 
        gfc_array_m2 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_m2);
diff --git a/libgfortran/generated/maxloc0_16_m4.c 
b/libgfortran/generated/maxloc0_16_m4.c
index 0144125709be..8cbe19898c3b 100644
--- a/libgfortran/generated/maxloc0_16_m4.c
+++ b/libgfortran/generated/maxloc0_16_m4.c
@@ -315,6 +315,7 @@ mmaxloc0_16_m4 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_m4 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_m4 (gfc_array_i16 * const restrict, 
        gfc_array_m4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_m4);
diff --git a/libgfortran/generated/maxloc0_16_m8.c 
b/libgfortran/generated/maxloc0_16_m8.c
index 96d6295e5c5c..839457451e5c 100644
--- a/libgfortran/generated/maxloc0_16_m8.c
+++ b/libgfortran/generated/maxloc0_16_m8.c
@@ -315,6 +315,7 @@ mmaxloc0_16_m8 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_m8 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_m8 (gfc_array_i16 * const restrict, 
        gfc_array_m8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_m8);
diff --git a/libgfortran/generated/maxloc0_16_r10.c 
b/libgfortran/generated/maxloc0_16_r10.c
index 2469dbb78162..ec2dfaa09638 100644
--- a/libgfortran/generated/maxloc0_16_r10.c
+++ b/libgfortran/generated/maxloc0_16_r10.c
@@ -315,6 +315,7 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_r10 (gfc_array_i16 * const restrict, 
        gfc_array_r10 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_r10);
diff --git a/libgfortran/generated/maxloc0_16_r16.c 
b/libgfortran/generated/maxloc0_16_r16.c
index f7270435e915..be3e43cd8da9 100644
--- a/libgfortran/generated/maxloc0_16_r16.c
+++ b/libgfortran/generated/maxloc0_16_r16.c
@@ -315,6 +315,7 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_r16 (gfc_array_i16 * const restrict, 
        gfc_array_r16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_r16);
diff --git a/libgfortran/generated/maxloc0_16_r17.c 
b/libgfortran/generated/maxloc0_16_r17.c
index e73d6c9de1a6..f4f84de2e06a 100644
--- a/libgfortran/generated/maxloc0_16_r17.c
+++ b/libgfortran/generated/maxloc0_16_r17.c
@@ -315,6 +315,7 @@ mmaxloc0_16_r17 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_r17 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_r17 (gfc_array_i16 * const restrict, 
        gfc_array_r17 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_r17);
diff --git a/libgfortran/generated/maxloc0_16_r4.c 
b/libgfortran/generated/maxloc0_16_r4.c
index 824a603198e9..83a5a1734df5 100644
--- a/libgfortran/generated/maxloc0_16_r4.c
+++ b/libgfortran/generated/maxloc0_16_r4.c
@@ -315,6 +315,7 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_r4 (gfc_array_i16 * const restrict, 
        gfc_array_r4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_r4);
diff --git a/libgfortran/generated/maxloc0_16_r8.c 
b/libgfortran/generated/maxloc0_16_r8.c
index a1086877d91b..02a9a95fd1ec 100644
--- a/libgfortran/generated/maxloc0_16_r8.c
+++ b/libgfortran/generated/maxloc0_16_r8.c
@@ -315,6 +315,7 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_16_r8 (gfc_array_i16 * const restrict, 
        gfc_array_r8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_16_r8);
diff --git a/libgfortran/generated/maxloc0_4_i1.c 
b/libgfortran/generated/maxloc0_4_i1.c
index 0af38ac3a547..82430c48e220 100644
--- a/libgfortran/generated/maxloc0_4_i1.c
+++ b/libgfortran/generated/maxloc0_4_i1.c
@@ -315,6 +315,7 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_i1 (gfc_array_i4 * const restrict, 
        gfc_array_i1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_i1);
diff --git a/libgfortran/generated/maxloc0_4_i16.c 
b/libgfortran/generated/maxloc0_4_i16.c
index 324865ff742e..a0c4db25e5af 100644
--- a/libgfortran/generated/maxloc0_4_i16.c
+++ b/libgfortran/generated/maxloc0_4_i16.c
@@ -315,6 +315,7 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_i16 (gfc_array_i4 * const restrict, 
        gfc_array_i16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_i16);
diff --git a/libgfortran/generated/maxloc0_4_i2.c 
b/libgfortran/generated/maxloc0_4_i2.c
index 4ee24587da7b..a340e0f591b1 100644
--- a/libgfortran/generated/maxloc0_4_i2.c
+++ b/libgfortran/generated/maxloc0_4_i2.c
@@ -315,6 +315,7 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_i2 (gfc_array_i4 * const restrict, 
        gfc_array_i2 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_i2);
diff --git a/libgfortran/generated/maxloc0_4_i4.c 
b/libgfortran/generated/maxloc0_4_i4.c
index a76778eed7c1..a2fe7d6361ee 100644
--- a/libgfortran/generated/maxloc0_4_i4.c
+++ b/libgfortran/generated/maxloc0_4_i4.c
@@ -315,6 +315,7 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_i4 (gfc_array_i4 * const restrict, 
        gfc_array_i4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_i4);
diff --git a/libgfortran/generated/maxloc0_4_i8.c 
b/libgfortran/generated/maxloc0_4_i8.c
index 9bf8b408e0d4..e03741a743dd 100644
--- a/libgfortran/generated/maxloc0_4_i8.c
+++ b/libgfortran/generated/maxloc0_4_i8.c
@@ -315,6 +315,7 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_i8 (gfc_array_i4 * const restrict, 
        gfc_array_i8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_i8);
diff --git a/libgfortran/generated/maxloc0_4_m1.c 
b/libgfortran/generated/maxloc0_4_m1.c
index 782595234711..514220bdecf7 100644
--- a/libgfortran/generated/maxloc0_4_m1.c
+++ b/libgfortran/generated/maxloc0_4_m1.c
@@ -315,6 +315,7 @@ mmaxloc0_4_m1 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_m1 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_m1 (gfc_array_i4 * const restrict, 
        gfc_array_m1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_m1);
diff --git a/libgfortran/generated/maxloc0_4_m16.c 
b/libgfortran/generated/maxloc0_4_m16.c
index 4e90c491d63a..6654cb91aead 100644
--- a/libgfortran/generated/maxloc0_4_m16.c
+++ b/libgfortran/generated/maxloc0_4_m16.c
@@ -315,6 +315,7 @@ mmaxloc0_4_m16 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_m16 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_m16 (gfc_array_i4 * const restrict, 
        gfc_array_m16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_m16);
diff --git a/libgfortran/generated/maxloc0_4_m2.c 
b/libgfortran/generated/maxloc0_4_m2.c
index b6b530bed636..283473bb43c2 100644
--- a/libgfortran/generated/maxloc0_4_m2.c
+++ b/libgfortran/generated/maxloc0_4_m2.c
@@ -315,6 +315,7 @@ mmaxloc0_4_m2 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_m2 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_m2 (gfc_array_i4 * const restrict, 
        gfc_array_m2 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_m2);
diff --git a/libgfortran/generated/maxloc0_4_m4.c 
b/libgfortran/generated/maxloc0_4_m4.c
index b3ee5af083be..b7b2af72371d 100644
--- a/libgfortran/generated/maxloc0_4_m4.c
+++ b/libgfortran/generated/maxloc0_4_m4.c
@@ -315,6 +315,7 @@ mmaxloc0_4_m4 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_m4 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_m4 (gfc_array_i4 * const restrict, 
        gfc_array_m4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_m4);
diff --git a/libgfortran/generated/maxloc0_4_m8.c 
b/libgfortran/generated/maxloc0_4_m8.c
index 4f7ec059f965..2834d5df498b 100644
--- a/libgfortran/generated/maxloc0_4_m8.c
+++ b/libgfortran/generated/maxloc0_4_m8.c
@@ -315,6 +315,7 @@ mmaxloc0_4_m8 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_m8 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_m8 (gfc_array_i4 * const restrict, 
        gfc_array_m8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_m8);
diff --git a/libgfortran/generated/maxloc0_4_r10.c 
b/libgfortran/generated/maxloc0_4_r10.c
index 8b2943114ab3..09908a96422b 100644
--- a/libgfortran/generated/maxloc0_4_r10.c
+++ b/libgfortran/generated/maxloc0_4_r10.c
@@ -315,6 +315,7 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_r10 (gfc_array_i4 * const restrict, 
        gfc_array_r10 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_r10);
diff --git a/libgfortran/generated/maxloc0_4_r16.c 
b/libgfortran/generated/maxloc0_4_r16.c
index caf56a40728a..e00929b48ce4 100644
--- a/libgfortran/generated/maxloc0_4_r16.c
+++ b/libgfortran/generated/maxloc0_4_r16.c
@@ -315,6 +315,7 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_r16 (gfc_array_i4 * const restrict, 
        gfc_array_r16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_r16);
diff --git a/libgfortran/generated/maxloc0_4_r17.c 
b/libgfortran/generated/maxloc0_4_r17.c
index ed7710388dab..0a913ea6b319 100644
--- a/libgfortran/generated/maxloc0_4_r17.c
+++ b/libgfortran/generated/maxloc0_4_r17.c
@@ -315,6 +315,7 @@ mmaxloc0_4_r17 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_r17 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_r17 (gfc_array_i4 * const restrict, 
        gfc_array_r17 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_r17);
diff --git a/libgfortran/generated/maxloc0_4_r4.c 
b/libgfortran/generated/maxloc0_4_r4.c
index bc52f9d851f3..d95a680eccb9 100644
--- a/libgfortran/generated/maxloc0_4_r4.c
+++ b/libgfortran/generated/maxloc0_4_r4.c
@@ -315,6 +315,7 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_r4 (gfc_array_i4 * const restrict, 
        gfc_array_r4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_r4);
diff --git a/libgfortran/generated/maxloc0_4_r8.c 
b/libgfortran/generated/maxloc0_4_r8.c
index dac48d3ae4af..f62d82b0d5d9 100644
--- a/libgfortran/generated/maxloc0_4_r8.c
+++ b/libgfortran/generated/maxloc0_4_r8.c
@@ -315,6 +315,7 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_4_r8 (gfc_array_i4 * const restrict, 
        gfc_array_r8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_4_r8);
diff --git a/libgfortran/generated/maxloc0_8_i1.c 
b/libgfortran/generated/maxloc0_8_i1.c
index fb0f3e68205b..352a0974efba 100644
--- a/libgfortran/generated/maxloc0_8_i1.c
+++ b/libgfortran/generated/maxloc0_8_i1.c
@@ -315,6 +315,7 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_i1 (gfc_array_i8 * const restrict, 
        gfc_array_i1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_i1);
diff --git a/libgfortran/generated/maxloc0_8_i16.c 
b/libgfortran/generated/maxloc0_8_i16.c
index c6c33a08a2e8..cdd2bd7bdd49 100644
--- a/libgfortran/generated/maxloc0_8_i16.c
+++ b/libgfortran/generated/maxloc0_8_i16.c
@@ -315,6 +315,7 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_i16 (gfc_array_i8 * const restrict, 
        gfc_array_i16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_i16);
diff --git a/libgfortran/generated/maxloc0_8_i2.c 
b/libgfortran/generated/maxloc0_8_i2.c
index 19f9b82e0012..fd27b23134ff 100644
--- a/libgfortran/generated/maxloc0_8_i2.c
+++ b/libgfortran/generated/maxloc0_8_i2.c
@@ -315,6 +315,7 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_i2 (gfc_array_i8 * const restrict, 
        gfc_array_i2 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_i2);
diff --git a/libgfortran/generated/maxloc0_8_i4.c 
b/libgfortran/generated/maxloc0_8_i4.c
index de45fd2f43ac..1182449d3d37 100644
--- a/libgfortran/generated/maxloc0_8_i4.c
+++ b/libgfortran/generated/maxloc0_8_i4.c
@@ -315,6 +315,7 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_i4 (gfc_array_i8 * const restrict, 
        gfc_array_i4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_i4);
diff --git a/libgfortran/generated/maxloc0_8_i8.c 
b/libgfortran/generated/maxloc0_8_i8.c
index fd5d2ab91f73..811d8845aae1 100644
--- a/libgfortran/generated/maxloc0_8_i8.c
+++ b/libgfortran/generated/maxloc0_8_i8.c
@@ -315,6 +315,7 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_i8 (gfc_array_i8 * const restrict, 
        gfc_array_i8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_i8);
diff --git a/libgfortran/generated/maxloc0_8_m1.c 
b/libgfortran/generated/maxloc0_8_m1.c
index 2b4b0e7fcbec..65e02ed2b5e9 100644
--- a/libgfortran/generated/maxloc0_8_m1.c
+++ b/libgfortran/generated/maxloc0_8_m1.c
@@ -315,6 +315,7 @@ mmaxloc0_8_m1 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_m1 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_m1 (gfc_array_i8 * const restrict, 
        gfc_array_m1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_m1);
diff --git a/libgfortran/generated/maxloc0_8_m16.c 
b/libgfortran/generated/maxloc0_8_m16.c
index da03132c2e8b..5db757ded4be 100644
--- a/libgfortran/generated/maxloc0_8_m16.c
+++ b/libgfortran/generated/maxloc0_8_m16.c
@@ -315,6 +315,7 @@ mmaxloc0_8_m16 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_m16 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_m16 (gfc_array_i8 * const restrict, 
        gfc_array_m16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_m16);
diff --git a/libgfortran/generated/maxloc0_8_m2.c 
b/libgfortran/generated/maxloc0_8_m2.c
index 0c7b74c06f80..97f002f9e401 100644
--- a/libgfortran/generated/maxloc0_8_m2.c
+++ b/libgfortran/generated/maxloc0_8_m2.c
@@ -315,6 +315,7 @@ mmaxloc0_8_m2 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_m2 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_m2 (gfc_array_i8 * const restrict, 
        gfc_array_m2 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_m2);
diff --git a/libgfortran/generated/maxloc0_8_m4.c 
b/libgfortran/generated/maxloc0_8_m4.c
index 307a04b697c6..90fe1e970cde 100644
--- a/libgfortran/generated/maxloc0_8_m4.c
+++ b/libgfortran/generated/maxloc0_8_m4.c
@@ -315,6 +315,7 @@ mmaxloc0_8_m4 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_m4 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_m4 (gfc_array_i8 * const restrict, 
        gfc_array_m4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_m4);
diff --git a/libgfortran/generated/maxloc0_8_m8.c 
b/libgfortran/generated/maxloc0_8_m8.c
index 5160418c8d95..9d667942f894 100644
--- a/libgfortran/generated/maxloc0_8_m8.c
+++ b/libgfortran/generated/maxloc0_8_m8.c
@@ -315,6 +315,7 @@ mmaxloc0_8_m8 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_m8 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_m8 (gfc_array_i8 * const restrict, 
        gfc_array_m8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_m8);
diff --git a/libgfortran/generated/maxloc0_8_r10.c 
b/libgfortran/generated/maxloc0_8_r10.c
index 09a9145f8dea..a305b9ca6007 100644
--- a/libgfortran/generated/maxloc0_8_r10.c
+++ b/libgfortran/generated/maxloc0_8_r10.c
@@ -315,6 +315,7 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_r10 (gfc_array_i8 * const restrict, 
        gfc_array_r10 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_r10);
diff --git a/libgfortran/generated/maxloc0_8_r16.c 
b/libgfortran/generated/maxloc0_8_r16.c
index b33713f016e8..a8e8b45a954d 100644
--- a/libgfortran/generated/maxloc0_8_r16.c
+++ b/libgfortran/generated/maxloc0_8_r16.c
@@ -315,6 +315,7 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_r16 (gfc_array_i8 * const restrict, 
        gfc_array_r16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_r16);
diff --git a/libgfortran/generated/maxloc0_8_r17.c 
b/libgfortran/generated/maxloc0_8_r17.c
index c008861d0633..37446a34974a 100644
--- a/libgfortran/generated/maxloc0_8_r17.c
+++ b/libgfortran/generated/maxloc0_8_r17.c
@@ -315,6 +315,7 @@ mmaxloc0_8_r17 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_r17 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_r17 (gfc_array_i8 * const restrict, 
        gfc_array_r17 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_r17);
diff --git a/libgfortran/generated/maxloc0_8_r4.c 
b/libgfortran/generated/maxloc0_8_r4.c
index f2216a7b2421..15f0bf03db2d 100644
--- a/libgfortran/generated/maxloc0_8_r4.c
+++ b/libgfortran/generated/maxloc0_8_r4.c
@@ -315,6 +315,7 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_r4 (gfc_array_i8 * const restrict, 
        gfc_array_r4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_r4);
diff --git a/libgfortran/generated/maxloc0_8_r8.c 
b/libgfortran/generated/maxloc0_8_r8.c
index b54fd05e6a39..9a6ce40ea89e 100644
--- a/libgfortran/generated/maxloc0_8_r8.c
+++ b/libgfortran/generated/maxloc0_8_r8.c
@@ -315,6 +315,7 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -361,7 +362,6 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
   }
 }
 
-
 extern void smaxloc0_8_r8 (gfc_array_i8 * const restrict, 
        gfc_array_r8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4);
 export_proto(smaxloc0_8_r8);
diff --git a/libgfortran/generated/minloc0_16_i1.c 
b/libgfortran/generated/minloc0_16_i1.c
index adc226f2d808..caae3c0909f6 100644
--- a/libgfortran/generated/minloc0_16_i1.c
+++ b/libgfortran/generated/minloc0_16_i1.c
@@ -314,9 +314,10 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_i16.c 
b/libgfortran/generated/minloc0_16_i16.c
index 2202a1e8fa96..aabf07632089 100644
--- a/libgfortran/generated/minloc0_16_i16.c
+++ b/libgfortran/generated/minloc0_16_i16.c
@@ -314,9 +314,10 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_i2.c 
b/libgfortran/generated/minloc0_16_i2.c
index 555d1ab7b25a..1d4fd9514c1c 100644
--- a/libgfortran/generated/minloc0_16_i2.c
+++ b/libgfortran/generated/minloc0_16_i2.c
@@ -314,9 +314,10 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_i4.c 
b/libgfortran/generated/minloc0_16_i4.c
index 046c5959dd82..04e99468b1b8 100644
--- a/libgfortran/generated/minloc0_16_i4.c
+++ b/libgfortran/generated/minloc0_16_i4.c
@@ -314,9 +314,10 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_i8.c 
b/libgfortran/generated/minloc0_16_i8.c
index f92fd5044967..b061432723dc 100644
--- a/libgfortran/generated/minloc0_16_i8.c
+++ b/libgfortran/generated/minloc0_16_i8.c
@@ -314,9 +314,10 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_m1.c 
b/libgfortran/generated/minloc0_16_m1.c
index 22773727559b..8427be799269 100644
--- a/libgfortran/generated/minloc0_16_m1.c
+++ b/libgfortran/generated/minloc0_16_m1.c
@@ -314,9 +314,10 @@ mminloc0_16_m1 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_m16.c 
b/libgfortran/generated/minloc0_16_m16.c
index 98714e48b779..7da464bb0313 100644
--- a/libgfortran/generated/minloc0_16_m16.c
+++ b/libgfortran/generated/minloc0_16_m16.c
@@ -314,9 +314,10 @@ mminloc0_16_m16 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_m2.c 
b/libgfortran/generated/minloc0_16_m2.c
index 43337a3a33fb..c4556248237f 100644
--- a/libgfortran/generated/minloc0_16_m2.c
+++ b/libgfortran/generated/minloc0_16_m2.c
@@ -314,9 +314,10 @@ mminloc0_16_m2 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_m4.c 
b/libgfortran/generated/minloc0_16_m4.c
index 7752c7d8f9f6..bb69694a0154 100644
--- a/libgfortran/generated/minloc0_16_m4.c
+++ b/libgfortran/generated/minloc0_16_m4.c
@@ -314,9 +314,10 @@ mminloc0_16_m4 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_m8.c 
b/libgfortran/generated/minloc0_16_m8.c
index fb32a4d74a8c..7aa4ca9e1c54 100644
--- a/libgfortran/generated/minloc0_16_m8.c
+++ b/libgfortran/generated/minloc0_16_m8.c
@@ -314,9 +314,10 @@ mminloc0_16_m8 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_r10.c 
b/libgfortran/generated/minloc0_16_r10.c
index b8afb7d5da8c..9ffc573dcf25 100644
--- a/libgfortran/generated/minloc0_16_r10.c
+++ b/libgfortran/generated/minloc0_16_r10.c
@@ -314,9 +314,10 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_r16.c 
b/libgfortran/generated/minloc0_16_r16.c
index 000d687dfb8f..d5bfb820ed76 100644
--- a/libgfortran/generated/minloc0_16_r16.c
+++ b/libgfortran/generated/minloc0_16_r16.c
@@ -314,9 +314,10 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_r17.c 
b/libgfortran/generated/minloc0_16_r17.c
index 25f8177c1e6c..61eef3d19a28 100644
--- a/libgfortran/generated/minloc0_16_r17.c
+++ b/libgfortran/generated/minloc0_16_r17.c
@@ -314,9 +314,10 @@ mminloc0_16_r17 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_r4.c 
b/libgfortran/generated/minloc0_16_r4.c
index 6b0970ec3608..ca420fe472b5 100644
--- a/libgfortran/generated/minloc0_16_r4.c
+++ b/libgfortran/generated/minloc0_16_r4.c
@@ -314,9 +314,10 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_16_r8.c 
b/libgfortran/generated/minloc0_16_r8.c
index 5505e46e795c..9fde0780917f 100644
--- a/libgfortran/generated/minloc0_16_r8.c
+++ b/libgfortran/generated/minloc0_16_r8.c
@@ -314,9 +314,10 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_i1.c 
b/libgfortran/generated/minloc0_4_i1.c
index b031308e7b3f..e6e16c87f12b 100644
--- a/libgfortran/generated/minloc0_4_i1.c
+++ b/libgfortran/generated/minloc0_4_i1.c
@@ -314,9 +314,10 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_i16.c 
b/libgfortran/generated/minloc0_4_i16.c
index 6f843bc69057..f7572e048227 100644
--- a/libgfortran/generated/minloc0_4_i16.c
+++ b/libgfortran/generated/minloc0_4_i16.c
@@ -314,9 +314,10 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_i2.c 
b/libgfortran/generated/minloc0_4_i2.c
index 5008a15643fa..41bda8a37621 100644
--- a/libgfortran/generated/minloc0_4_i2.c
+++ b/libgfortran/generated/minloc0_4_i2.c
@@ -314,9 +314,10 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_i4.c 
b/libgfortran/generated/minloc0_4_i4.c
index eba892dbbb2a..d6885db19947 100644
--- a/libgfortran/generated/minloc0_4_i4.c
+++ b/libgfortran/generated/minloc0_4_i4.c
@@ -314,9 +314,10 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_i8.c 
b/libgfortran/generated/minloc0_4_i8.c
index b78bd240b2b4..f527256e3af0 100644
--- a/libgfortran/generated/minloc0_4_i8.c
+++ b/libgfortran/generated/minloc0_4_i8.c
@@ -314,9 +314,10 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_m1.c 
b/libgfortran/generated/minloc0_4_m1.c
index 311b727a045b..8434765edf94 100644
--- a/libgfortran/generated/minloc0_4_m1.c
+++ b/libgfortran/generated/minloc0_4_m1.c
@@ -314,9 +314,10 @@ mminloc0_4_m1 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_m16.c 
b/libgfortran/generated/minloc0_4_m16.c
index 988388cfbef2..9d0e1507b304 100644
--- a/libgfortran/generated/minloc0_4_m16.c
+++ b/libgfortran/generated/minloc0_4_m16.c
@@ -314,9 +314,10 @@ mminloc0_4_m16 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_m2.c 
b/libgfortran/generated/minloc0_4_m2.c
index 12391266fe19..7ef9f89e500c 100644
--- a/libgfortran/generated/minloc0_4_m2.c
+++ b/libgfortran/generated/minloc0_4_m2.c
@@ -314,9 +314,10 @@ mminloc0_4_m2 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_m4.c 
b/libgfortran/generated/minloc0_4_m4.c
index bab0048d5f05..38b44bfbb1c7 100644
--- a/libgfortran/generated/minloc0_4_m4.c
+++ b/libgfortran/generated/minloc0_4_m4.c
@@ -314,9 +314,10 @@ mminloc0_4_m4 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_m8.c 
b/libgfortran/generated/minloc0_4_m8.c
index bd461ece30b8..7c23e7f1ae8a 100644
--- a/libgfortran/generated/minloc0_4_m8.c
+++ b/libgfortran/generated/minloc0_4_m8.c
@@ -314,9 +314,10 @@ mminloc0_4_m8 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_r10.c 
b/libgfortran/generated/minloc0_4_r10.c
index 2b42ac17ef34..3b80e53a0558 100644
--- a/libgfortran/generated/minloc0_4_r10.c
+++ b/libgfortran/generated/minloc0_4_r10.c
@@ -314,9 +314,10 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_r16.c 
b/libgfortran/generated/minloc0_4_r16.c
index 630ab527a727..c3f911c01f65 100644
--- a/libgfortran/generated/minloc0_4_r16.c
+++ b/libgfortran/generated/minloc0_4_r16.c
@@ -314,9 +314,10 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_r17.c 
b/libgfortran/generated/minloc0_4_r17.c
index f86f9f3863c2..7c4a98e6463a 100644
--- a/libgfortran/generated/minloc0_4_r17.c
+++ b/libgfortran/generated/minloc0_4_r17.c
@@ -314,9 +314,10 @@ mminloc0_4_r17 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_r4.c 
b/libgfortran/generated/minloc0_4_r4.c
index 9b15aa6d825f..03978fa1ed69 100644
--- a/libgfortran/generated/minloc0_4_r4.c
+++ b/libgfortran/generated/minloc0_4_r4.c
@@ -314,9 +314,10 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_4_r8.c 
b/libgfortran/generated/minloc0_4_r8.c
index 97d7f09bf865..6a71484a13ec 100644
--- a/libgfortran/generated/minloc0_4_r8.c
+++ b/libgfortran/generated/minloc0_4_r8.c
@@ -314,9 +314,10 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_i1.c 
b/libgfortran/generated/minloc0_8_i1.c
index 4f3090f9939e..90df753da340 100644
--- a/libgfortran/generated/minloc0_8_i1.c
+++ b/libgfortran/generated/minloc0_8_i1.c
@@ -314,9 +314,10 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_i16.c 
b/libgfortran/generated/minloc0_8_i16.c
index 6e7ea6b43fed..6780a2401de6 100644
--- a/libgfortran/generated/minloc0_8_i16.c
+++ b/libgfortran/generated/minloc0_8_i16.c
@@ -314,9 +314,10 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_i2.c 
b/libgfortran/generated/minloc0_8_i2.c
index ff282efd0fc7..66c620145d15 100644
--- a/libgfortran/generated/minloc0_8_i2.c
+++ b/libgfortran/generated/minloc0_8_i2.c
@@ -314,9 +314,10 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_i4.c 
b/libgfortran/generated/minloc0_8_i4.c
index cae428e73cef..54378002cf60 100644
--- a/libgfortran/generated/minloc0_8_i4.c
+++ b/libgfortran/generated/minloc0_8_i4.c
@@ -314,9 +314,10 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_i8.c 
b/libgfortran/generated/minloc0_8_i8.c
index e474f0a13ad3..ac3d8b13d3c0 100644
--- a/libgfortran/generated/minloc0_8_i8.c
+++ b/libgfortran/generated/minloc0_8_i8.c
@@ -314,9 +314,10 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_m1.c 
b/libgfortran/generated/minloc0_8_m1.c
index 7f3c3073a1f0..dfc5ccdf2222 100644
--- a/libgfortran/generated/minloc0_8_m1.c
+++ b/libgfortran/generated/minloc0_8_m1.c
@@ -314,9 +314,10 @@ mminloc0_8_m1 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_m16.c 
b/libgfortran/generated/minloc0_8_m16.c
index c0635ee8e9e3..3b30a372bb74 100644
--- a/libgfortran/generated/minloc0_8_m16.c
+++ b/libgfortran/generated/minloc0_8_m16.c
@@ -314,9 +314,10 @@ mminloc0_8_m16 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_m2.c 
b/libgfortran/generated/minloc0_8_m2.c
index 7321b0ff2963..8f15346d3d94 100644
--- a/libgfortran/generated/minloc0_8_m2.c
+++ b/libgfortran/generated/minloc0_8_m2.c
@@ -314,9 +314,10 @@ mminloc0_8_m2 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_m4.c 
b/libgfortran/generated/minloc0_8_m4.c
index df185a565848..97553cdb2a57 100644
--- a/libgfortran/generated/minloc0_8_m4.c
+++ b/libgfortran/generated/minloc0_8_m4.c
@@ -314,9 +314,10 @@ mminloc0_8_m4 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_m8.c 
b/libgfortran/generated/minloc0_8_m8.c
index 1cc07ff5fe51..899daf43c3e2 100644
--- a/libgfortran/generated/minloc0_8_m8.c
+++ b/libgfortran/generated/minloc0_8_m8.c
@@ -314,9 +314,10 @@ mminloc0_8_m8 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_r10.c 
b/libgfortran/generated/minloc0_8_r10.c
index 646727ffc800..580d08a1fabe 100644
--- a/libgfortran/generated/minloc0_8_r10.c
+++ b/libgfortran/generated/minloc0_8_r10.c
@@ -314,9 +314,10 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_r16.c 
b/libgfortran/generated/minloc0_8_r16.c
index 9e1e0ff69477..a722121567b7 100644
--- a/libgfortran/generated/minloc0_8_r16.c
+++ b/libgfortran/generated/minloc0_8_r16.c
@@ -314,9 +314,10 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_r17.c 
b/libgfortran/generated/minloc0_8_r17.c
index fc4a4e79ac40..ea061111a97a 100644
--- a/libgfortran/generated/minloc0_8_r17.c
+++ b/libgfortran/generated/minloc0_8_r17.c
@@ -314,9 +314,10 @@ mminloc0_8_r17 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_r4.c 
b/libgfortran/generated/minloc0_8_r4.c
index 29096f435210..199e63420c23 100644
--- a/libgfortran/generated/minloc0_8_r4.c
+++ b/libgfortran/generated/minloc0_8_r4.c
@@ -314,9 +314,10 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/generated/minloc0_8_r8.c 
b/libgfortran/generated/minloc0_8_r8.c
index 142ffc87ae61..e464374d9f7c 100644
--- a/libgfortran/generated/minloc0_8_r8.c
+++ b/libgfortran/generated/minloc0_8_r8.c
@@ -314,9 +314,10 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray,
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {
diff --git a/libgfortran/m4/maxloc0.m4 b/libgfortran/m4/maxloc0.m4
index ca50cbddb6f1..95bc98677163 100644
--- a/libgfortran/m4/maxloc0.m4
+++ b/libgfortran/m4/maxloc0.m4
@@ -131,6 +131,7 @@ MASKED_FOREACH_FUNCTION(
                    dest[n * dstride] = count[n] + 1;
                }
              base += sstride[0];
+             mbase += mstride[0];
            }
          while (++count[0] != extent[0]);
        else
@@ -142,6 +143,5 @@ MASKED_FOREACH_FUNCTION(
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }')
-
 SCALAR_FOREACH_FUNCTION(`0')
 #endif
diff --git a/libgfortran/m4/minloc0.m4 b/libgfortran/m4/minloc0.m4
index 310d6d88c2ea..dbd650454ab9 100644
--- a/libgfortran/m4/minloc0.m4
+++ b/libgfortran/m4/minloc0.m4
@@ -130,9 +130,10 @@ MASKED_FOREACH_FUNCTION(
                  for (n = 0; n < rank; n++)
                    dest[n * dstride] = count[n] + 1;
                }
-               base += sstride[0];
+             base += sstride[0];
+             mbase += mstride[0];
            }
-           while (++count[0] != extent[0]);
+         while (++count[0] != extent[0]);
        else
          do
            {

Reply via email to