[gcc(refs/users/mikael/heads/refactor_descriptor_v08)] Régénération fichiers générés

Mikael Morin mikael@gcc.gnu.org
Tue Sep 9 14:25:21 GMT 2025


https://gcc.gnu.org/g:760f15c149b7a2fc86732545564993fa4f6a9459

commit 760f15c149b7a2fc86732545564993fa4f6a9459
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Tue Sep 9 16:24:09 2025 +0200

    Régénération fichiers générés

Diff:
---
 libgfortran/generated/matmul_c10.c       | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_c16.c       | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_c17.c       | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_c4.c        | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_c8.c        | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_i1.c        | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_i16.c       | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_i2.c        | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_i4.c        | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_i8.c        | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_r10.c       | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_r16.c       | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_r17.c       | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_r4.c        | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmul_r8.c        | 30 ++++++++++++++++++++----------
 libgfortran/generated/matmulavx128_c10.c | 12 ++++++++----
 libgfortran/generated/matmulavx128_c16.c | 12 ++++++++----
 libgfortran/generated/matmulavx128_c17.c | 12 ++++++++----
 libgfortran/generated/matmulavx128_c4.c  | 12 ++++++++----
 libgfortran/generated/matmulavx128_c8.c  | 12 ++++++++----
 libgfortran/generated/matmulavx128_i1.c  | 12 ++++++++----
 libgfortran/generated/matmulavx128_i16.c | 12 ++++++++----
 libgfortran/generated/matmulavx128_i2.c  | 12 ++++++++----
 libgfortran/generated/matmulavx128_i4.c  | 12 ++++++++----
 libgfortran/generated/matmulavx128_i8.c  | 12 ++++++++----
 libgfortran/generated/matmulavx128_r10.c | 12 ++++++++----
 libgfortran/generated/matmulavx128_r16.c | 12 ++++++++----
 libgfortran/generated/matmulavx128_r17.c | 12 ++++++++----
 libgfortran/generated/matmulavx128_r4.c  | 12 ++++++++----
 libgfortran/generated/matmulavx128_r8.c  | 12 ++++++++----
 30 files changed, 420 insertions(+), 210 deletions(-)

diff --git a/libgfortran/generated/matmul_c10.c b/libgfortran/generated/matmul_c10.c
index 76f2ef2d442f..57ea0b49dabb 100644
--- a/libgfortran/generated/matmul_c10.c
+++ b/libgfortran/generated/matmul_c10.c
@@ -94,7 +94,7 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_10) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_10) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_10) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_10) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_c10 (gfc_array_c10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_c10 (gfc_array_c10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_c10 (gfc_array_c10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_10) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_c16.c b/libgfortran/generated/matmul_c16.c
index ebaa27fb2623..c8d1a020c602 100644
--- a/libgfortran/generated/matmul_c16.c
+++ b/libgfortran/generated/matmul_c16.c
@@ -94,7 +94,7 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_c16 (gfc_array_c16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_c16 (gfc_array_c16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_c16 (gfc_array_c16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_16) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_c17.c b/libgfortran/generated/matmul_c17.c
index b13469d4ff1f..f469a51e4fc3 100644
--- a/libgfortran/generated/matmul_c17.c
+++ b/libgfortran/generated/matmul_c17.c
@@ -94,7 +94,7 @@ matmul_c17_avx (gfc_array_c17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_c17_avx (gfc_array_c17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_c17_avx (gfc_array_c17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_17) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_c17_avx2 (gfc_array_c17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_c17_avx2 (gfc_array_c17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_c17_avx2 (gfc_array_c17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_17) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_c17_avx512f (gfc_array_c17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_c17_avx512f (gfc_array_c17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_c17_avx512f (gfc_array_c17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_17) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_c17_vanilla (gfc_array_c17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_c17_vanilla (gfc_array_c17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_c17_vanilla (gfc_array_c17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_17) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_c17 (gfc_array_c17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_c17 (gfc_array_c17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_c17 (gfc_array_c17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_17) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_c4.c b/libgfortran/generated/matmul_c4.c
index 34a13045848f..2021a2241ac9 100644
--- a/libgfortran/generated/matmul_c4.c
+++ b/libgfortran/generated/matmul_c4.c
@@ -94,7 +94,7 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_c4_avx2 (gfc_array_c4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_c4_avx2 (gfc_array_c4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_c4_avx2 (gfc_array_c4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_c4_avx512f (gfc_array_c4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_c4_avx512f (gfc_array_c4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_c4_avx512f (gfc_array_c4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_c4_vanilla (gfc_array_c4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_c4_vanilla (gfc_array_c4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_c4_vanilla (gfc_array_c4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_c4 (gfc_array_c4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_c4 (gfc_array_c4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_c4 (gfc_array_c4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_4) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_c8.c b/libgfortran/generated/matmul_c8.c
index 9e27aabaa431..1bf177b43e40 100644
--- a/libgfortran/generated/matmul_c8.c
+++ b/libgfortran/generated/matmul_c8.c
@@ -94,7 +94,7 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_c8_avx2 (gfc_array_c8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_c8_avx2 (gfc_array_c8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_c8_avx2 (gfc_array_c8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_c8_avx512f (gfc_array_c8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_c8_avx512f (gfc_array_c8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_c8_avx512f (gfc_array_c8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_c8_vanilla (gfc_array_c8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_c8_vanilla (gfc_array_c8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_c8_vanilla (gfc_array_c8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_c8 (gfc_array_c8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_c8 (gfc_array_c8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_c8 (gfc_array_c8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_8) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_i1.c b/libgfortran/generated/matmul_i1.c
index 0340b21f3d73..d97fcffcbc5c 100644
--- a/libgfortran/generated/matmul_i1.c
+++ b/libgfortran/generated/matmul_i1.c
@@ -94,7 +94,7 @@ matmul_i1_avx (gfc_array_m1 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_i1_avx (gfc_array_m1 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_i1_avx (gfc_array_m1 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_1) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_1) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_1) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_i1_avx2 (gfc_array_m1 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_i1_avx2 (gfc_array_m1 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_i1_avx2 (gfc_array_m1 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_1) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_1) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_1) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_i1_avx512f (gfc_array_m1 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_i1_avx512f (gfc_array_m1 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_i1_avx512f (gfc_array_m1 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_1) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_1) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_1) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_i1_vanilla (gfc_array_m1 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_i1_vanilla (gfc_array_m1 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_i1_vanilla (gfc_array_m1 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_1) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_1) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_1) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_i1 (gfc_array_m1 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_i1 (gfc_array_m1 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_i1 (gfc_array_m1 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_1) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_1) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_1) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_i16.c b/libgfortran/generated/matmul_i16.c
index 452d6d165303..1ec18ffa266c 100644
--- a/libgfortran/generated/matmul_i16.c
+++ b/libgfortran/generated/matmul_i16.c
@@ -94,7 +94,7 @@ matmul_i16_avx (gfc_array_m16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_i16_avx (gfc_array_m16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_i16_avx (gfc_array_m16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_i16_avx2 (gfc_array_m16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_i16_avx2 (gfc_array_m16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_i16_avx2 (gfc_array_m16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_i16_avx512f (gfc_array_m16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_i16_avx512f (gfc_array_m16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_i16_avx512f (gfc_array_m16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_i16_vanilla (gfc_array_m16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_i16_vanilla (gfc_array_m16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_i16_vanilla (gfc_array_m16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_i16 (gfc_array_m16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_i16 (gfc_array_m16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_i16 (gfc_array_m16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_16) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_i2.c b/libgfortran/generated/matmul_i2.c
index f83e91079813..ae55537724f2 100644
--- a/libgfortran/generated/matmul_i2.c
+++ b/libgfortran/generated/matmul_i2.c
@@ -94,7 +94,7 @@ matmul_i2_avx (gfc_array_m2 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_i2_avx (gfc_array_m2 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_i2_avx (gfc_array_m2 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_2) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_2) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_2) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_i2_avx2 (gfc_array_m2 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_i2_avx2 (gfc_array_m2 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_i2_avx2 (gfc_array_m2 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_2) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_2) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_2) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_i2_avx512f (gfc_array_m2 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_i2_avx512f (gfc_array_m2 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_i2_avx512f (gfc_array_m2 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_2) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_2) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_2) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_i2_vanilla (gfc_array_m2 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_i2_vanilla (gfc_array_m2 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_i2_vanilla (gfc_array_m2 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_2) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_2) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_2) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_i2 (gfc_array_m2 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_i2 (gfc_array_m2 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_i2 (gfc_array_m2 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_2) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_2) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_2) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_i4.c b/libgfortran/generated/matmul_i4.c
index 88fb93b7985d..6d6ecd27a6c9 100644
--- a/libgfortran/generated/matmul_i4.c
+++ b/libgfortran/generated/matmul_i4.c
@@ -94,7 +94,7 @@ matmul_i4_avx (gfc_array_m4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_i4_avx (gfc_array_m4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_i4_avx (gfc_array_m4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_i4_avx2 (gfc_array_m4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_i4_avx2 (gfc_array_m4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_i4_avx2 (gfc_array_m4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_i4_avx512f (gfc_array_m4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_i4_avx512f (gfc_array_m4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_i4_avx512f (gfc_array_m4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_i4_vanilla (gfc_array_m4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_i4_vanilla (gfc_array_m4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_i4_vanilla (gfc_array_m4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_i4 (gfc_array_m4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_i4 (gfc_array_m4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_i4 (gfc_array_m4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_4) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_i8.c b/libgfortran/generated/matmul_i8.c
index 96974cdaf1fe..7db31f32eb34 100644
--- a/libgfortran/generated/matmul_i8.c
+++ b/libgfortran/generated/matmul_i8.c
@@ -94,7 +94,7 @@ matmul_i8_avx (gfc_array_m8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_i8_avx (gfc_array_m8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_i8_avx (gfc_array_m8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_i8_avx2 (gfc_array_m8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_i8_avx2 (gfc_array_m8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_i8_avx2 (gfc_array_m8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_i8_avx512f (gfc_array_m8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_i8_avx512f (gfc_array_m8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_i8_avx512f (gfc_array_m8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_i8_vanilla (gfc_array_m8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_i8_vanilla (gfc_array_m8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_i8_vanilla (gfc_array_m8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_i8 (gfc_array_m8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_i8 (gfc_array_m8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_i8 (gfc_array_m8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_UINTEGER_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_UINTEGER_8) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_r10.c b/libgfortran/generated/matmul_r10.c
index dfa9452d59e8..a5da96af9c94 100644
--- a/libgfortran/generated/matmul_r10.c
+++ b/libgfortran/generated/matmul_r10.c
@@ -94,7 +94,7 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_10) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_r10_avx2 (gfc_array_r10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_r10_avx2 (gfc_array_r10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_r10_avx2 (gfc_array_r10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_10) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_r10_avx512f (gfc_array_r10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_r10_avx512f (gfc_array_r10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_r10_avx512f (gfc_array_r10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_10) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_r10_vanilla (gfc_array_r10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_r10_vanilla (gfc_array_r10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_r10_vanilla (gfc_array_r10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_10) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_r10 (gfc_array_r10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_r10 (gfc_array_r10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_r10 (gfc_array_r10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_10) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_r16.c b/libgfortran/generated/matmul_r16.c
index 7b7992d5b70e..927a86c324bf 100644
--- a/libgfortran/generated/matmul_r16.c
+++ b/libgfortran/generated/matmul_r16.c
@@ -94,7 +94,7 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_r16_avx2 (gfc_array_r16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_r16_avx2 (gfc_array_r16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_r16_avx2 (gfc_array_r16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_r16_avx512f (gfc_array_r16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_r16_avx512f (gfc_array_r16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_r16_avx512f (gfc_array_r16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_r16_vanilla (gfc_array_r16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_r16_vanilla (gfc_array_r16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_r16_vanilla (gfc_array_r16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_r16 (gfc_array_r16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_r16 (gfc_array_r16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_r16 (gfc_array_r16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_16) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_r17.c b/libgfortran/generated/matmul_r17.c
index 5372c0d4965f..57935ae77de8 100644
--- a/libgfortran/generated/matmul_r17.c
+++ b/libgfortran/generated/matmul_r17.c
@@ -94,7 +94,7 @@ matmul_r17_avx (gfc_array_r17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_r17_avx (gfc_array_r17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_r17_avx (gfc_array_r17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_17) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_r17_avx2 (gfc_array_r17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_r17_avx2 (gfc_array_r17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_r17_avx2 (gfc_array_r17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_17) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_r17_avx512f (gfc_array_r17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_r17_avx512f (gfc_array_r17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_r17_avx512f (gfc_array_r17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_17) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_r17_vanilla (gfc_array_r17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_r17_vanilla (gfc_array_r17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_r17_vanilla (gfc_array_r17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_17) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_r17 (gfc_array_r17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_r17 (gfc_array_r17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_r17 (gfc_array_r17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_17) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_r4.c b/libgfortran/generated/matmul_r4.c
index 2cef4e0138c2..cb9fcdd53cd7 100644
--- a/libgfortran/generated/matmul_r4.c
+++ b/libgfortran/generated/matmul_r4.c
@@ -94,7 +94,7 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_r4_avx2 (gfc_array_r4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_r4_avx2 (gfc_array_r4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_r4_avx2 (gfc_array_r4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_r4_avx512f (gfc_array_r4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_r4_avx512f (gfc_array_r4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_r4_avx512f (gfc_array_r4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_r4_vanilla (gfc_array_r4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_r4_vanilla (gfc_array_r4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_r4_vanilla (gfc_array_r4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_r4 (gfc_array_r4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_r4 (gfc_array_r4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_r4 (gfc_array_r4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_4) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmul_r8.c b/libgfortran/generated/matmul_r8.c
index b06981e0b645..393d499a26d4 100644
--- a/libgfortran/generated/matmul_r8.c
+++ b/libgfortran/generated/matmul_r8.c
@@ -94,7 +94,7 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -183,11 +183,13 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -313,7 +315,7 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -663,7 +665,7 @@ matmul_r8_avx2 (gfc_array_r8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -752,11 +754,13 @@ matmul_r8_avx2 (gfc_array_r8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -882,7 +886,7 @@ matmul_r8_avx2 (gfc_array_r8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -1232,7 +1236,7 @@ matmul_r8_avx512f (gfc_array_r8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1321,11 +1325,13 @@ matmul_r8_avx512f (gfc_array_r8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -1451,7 +1457,7 @@ matmul_r8_avx512f (gfc_array_r8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -1815,7 +1821,7 @@ matmul_r8_vanilla (gfc_array_r8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -1904,11 +1910,13 @@ matmul_r8_vanilla (gfc_array_r8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2034,7 +2042,7 @@ matmul_r8_vanilla (gfc_array_r8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -2457,7 +2465,7 @@ matmul_r8 (gfc_array_r8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -2546,11 +2554,13 @@ matmul_r8 (gfc_array_r8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -2676,7 +2686,7 @@ matmul_r8 (gfc_array_r8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_8) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_c10.c b/libgfortran/generated/matmulavx128_c10.c
index a54b40b6e26d..aab472dc0173 100644
--- a/libgfortran/generated/matmulavx128_c10.c
+++ b/libgfortran/generated/matmulavx128_c10.c
@@ -59,7 +59,7 @@ matmul_c10_avx128_fma3 (gfc_array_c10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_c10_avx128_fma3 (gfc_array_c10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_c10_avx128_fma3 (gfc_array_c10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_10) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_c10_avx128_fma4 (gfc_array_c10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_c10_avx128_fma4 (gfc_array_c10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_c10_avx128_fma4 (gfc_array_c10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_10) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_c16.c b/libgfortran/generated/matmulavx128_c16.c
index 7dd2d6233014..ccd576a4a1ac 100644
--- a/libgfortran/generated/matmulavx128_c16.c
+++ b/libgfortran/generated/matmulavx128_c16.c
@@ -59,7 +59,7 @@ matmul_c16_avx128_fma3 (gfc_array_c16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_c16_avx128_fma3 (gfc_array_c16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_c16_avx128_fma3 (gfc_array_c16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_c16_avx128_fma4 (gfc_array_c16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_c16_avx128_fma4 (gfc_array_c16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_c16_avx128_fma4 (gfc_array_c16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_16) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_c17.c b/libgfortran/generated/matmulavx128_c17.c
index 94edff10e3fb..a9de945dbd08 100644
--- a/libgfortran/generated/matmulavx128_c17.c
+++ b/libgfortran/generated/matmulavx128_c17.c
@@ -59,7 +59,7 @@ matmul_c17_avx128_fma3 (gfc_array_c17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_c17_avx128_fma3 (gfc_array_c17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_c17_avx128_fma3 (gfc_array_c17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_17) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_c17_avx128_fma4 (gfc_array_c17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_c17_avx128_fma4 (gfc_array_c17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_c17_avx128_fma4 (gfc_array_c17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_17) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_c4.c b/libgfortran/generated/matmulavx128_c4.c
index a8ea0cf97a4b..2ad76f03c3c8 100644
--- a/libgfortran/generated/matmulavx128_c4.c
+++ b/libgfortran/generated/matmulavx128_c4.c
@@ -59,7 +59,7 @@ matmul_c4_avx128_fma3 (gfc_array_c4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_c4_avx128_fma3 (gfc_array_c4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_c4_avx128_fma3 (gfc_array_c4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_c4_avx128_fma4 (gfc_array_c4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_c4_avx128_fma4 (gfc_array_c4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_c4_avx128_fma4 (gfc_array_c4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_4) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_c8.c b/libgfortran/generated/matmulavx128_c8.c
index 0ad53e6dc3b1..5629c22773ed 100644
--- a/libgfortran/generated/matmulavx128_c8.c
+++ b/libgfortran/generated/matmulavx128_c8.c
@@ -59,7 +59,7 @@ matmul_c8_avx128_fma3 (gfc_array_c8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_c8_avx128_fma3 (gfc_array_c8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_c8_avx128_fma3 (gfc_array_c8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_c8_avx128_fma4 (gfc_array_c8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_c8_avx128_fma4 (gfc_array_c8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_c8_avx128_fma4 (gfc_array_c8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_COMPLEX_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_COMPLEX_8) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_i1.c b/libgfortran/generated/matmulavx128_i1.c
index c17f3edfc5d1..b59894baf090 100644
--- a/libgfortran/generated/matmulavx128_i1.c
+++ b/libgfortran/generated/matmulavx128_i1.c
@@ -59,7 +59,7 @@ matmul_i1_avx128_fma3 (gfc_array_i1 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_i1_avx128_fma3 (gfc_array_i1 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_i1_avx128_fma3 (gfc_array_i1 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_1) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_1) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_INTEGER_1) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_i1_avx128_fma4 (gfc_array_i1 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_i1_avx128_fma4 (gfc_array_i1 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_i1_avx128_fma4 (gfc_array_i1 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_1) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_1) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_INTEGER_1) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_i16.c b/libgfortran/generated/matmulavx128_i16.c
index 15f37fd1ce98..a580a348f2c2 100644
--- a/libgfortran/generated/matmulavx128_i16.c
+++ b/libgfortran/generated/matmulavx128_i16.c
@@ -59,7 +59,7 @@ matmul_i16_avx128_fma3 (gfc_array_i16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_i16_avx128_fma3 (gfc_array_i16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_i16_avx128_fma3 (gfc_array_i16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_INTEGER_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_i16_avx128_fma4 (gfc_array_i16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_i16_avx128_fma4 (gfc_array_i16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_i16_avx128_fma4 (gfc_array_i16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_INTEGER_16) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_i2.c b/libgfortran/generated/matmulavx128_i2.c
index 247eb3159738..ff002dadc31c 100644
--- a/libgfortran/generated/matmulavx128_i2.c
+++ b/libgfortran/generated/matmulavx128_i2.c
@@ -59,7 +59,7 @@ matmul_i2_avx128_fma3 (gfc_array_i2 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_i2_avx128_fma3 (gfc_array_i2 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_i2_avx128_fma3 (gfc_array_i2 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_2) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_2) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_INTEGER_2) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_i2_avx128_fma4 (gfc_array_i2 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_i2_avx128_fma4 (gfc_array_i2 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_i2_avx128_fma4 (gfc_array_i2 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_2) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_2) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_INTEGER_2) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_i4.c b/libgfortran/generated/matmulavx128_i4.c
index aa6a5f50c5ac..9a9acd404bf4 100644
--- a/libgfortran/generated/matmulavx128_i4.c
+++ b/libgfortran/generated/matmulavx128_i4.c
@@ -59,7 +59,7 @@ matmul_i4_avx128_fma3 (gfc_array_i4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_i4_avx128_fma3 (gfc_array_i4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_i4_avx128_fma3 (gfc_array_i4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_INTEGER_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_i4_avx128_fma4 (gfc_array_i4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_i4_avx128_fma4 (gfc_array_i4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_i4_avx128_fma4 (gfc_array_i4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_INTEGER_4) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_i8.c b/libgfortran/generated/matmulavx128_i8.c
index fecf6252ef37..2d442f8d6b31 100644
--- a/libgfortran/generated/matmulavx128_i8.c
+++ b/libgfortran/generated/matmulavx128_i8.c
@@ -59,7 +59,7 @@ matmul_i8_avx128_fma3 (gfc_array_i8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_i8_avx128_fma3 (gfc_array_i8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_i8_avx128_fma3 (gfc_array_i8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_INTEGER_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_i8_avx128_fma4 (gfc_array_i8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_i8_avx128_fma4 (gfc_array_i8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_i8_avx128_fma4 (gfc_array_i8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_INTEGER_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_INTEGER_8) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_r10.c b/libgfortran/generated/matmulavx128_r10.c
index 14e6ea1f5c43..3a345decbced 100644
--- a/libgfortran/generated/matmulavx128_r10.c
+++ b/libgfortran/generated/matmulavx128_r10.c
@@ -59,7 +59,7 @@ matmul_r10_avx128_fma3 (gfc_array_r10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_r10_avx128_fma3 (gfc_array_r10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_r10_avx128_fma3 (gfc_array_r10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_10) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_r10_avx128_fma4 (gfc_array_r10 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_r10_avx128_fma4 (gfc_array_r10 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_r10_avx128_fma4 (gfc_array_r10 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_10) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_10) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_r16.c b/libgfortran/generated/matmulavx128_r16.c
index 62917949db7e..8e92f7380188 100644
--- a/libgfortran/generated/matmulavx128_r16.c
+++ b/libgfortran/generated/matmulavx128_r16.c
@@ -59,7 +59,7 @@ matmul_r16_avx128_fma3 (gfc_array_r16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_r16_avx128_fma3 (gfc_array_r16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_r16_avx128_fma3 (gfc_array_r16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_16) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_r16_avx128_fma4 (gfc_array_r16 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_r16_avx128_fma4 (gfc_array_r16 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_r16_avx128_fma4 (gfc_array_r16 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_16) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_16) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_r17.c b/libgfortran/generated/matmulavx128_r17.c
index e67518275825..aafb24ad872a 100644
--- a/libgfortran/generated/matmulavx128_r17.c
+++ b/libgfortran/generated/matmulavx128_r17.c
@@ -59,7 +59,7 @@ matmul_r17_avx128_fma3 (gfc_array_r17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_r17_avx128_fma3 (gfc_array_r17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_r17_avx128_fma3 (gfc_array_r17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_17) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_r17_avx128_fma4 (gfc_array_r17 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_r17_avx128_fma4 (gfc_array_r17 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_r17_avx128_fma4 (gfc_array_r17 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_17) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_17) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_r4.c b/libgfortran/generated/matmulavx128_r4.c
index c771b8f1355c..528c99bedaba 100644
--- a/libgfortran/generated/matmulavx128_r4.c
+++ b/libgfortran/generated/matmulavx128_r4.c
@@ -59,7 +59,7 @@ matmul_r4_avx128_fma3 (gfc_array_r4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_r4_avx128_fma3 (gfc_array_r4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_r4_avx128_fma3 (gfc_array_r4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_4) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_r4_avx128_fma4 (gfc_array_r4 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_r4_avx128_fma4 (gfc_array_r4 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_r4_avx128_fma4 (gfc_array_r4 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_4) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_4) + aystride_bytes);
       b_dim1 = bystride;
diff --git a/libgfortran/generated/matmulavx128_r8.c b/libgfortran/generated/matmulavx128_r8.c
index 6f7a12c37bb6..9b514e670f4b 100644
--- a/libgfortran/generated/matmulavx128_r8.c
+++ b/libgfortran/generated/matmulavx128_r8.c
@@ -59,7 +59,7 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -148,11 +148,13 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -278,7 +280,7 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_8) + aystride_bytes);
       b_dim1 = bystride;
@@ -629,7 +631,7 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray,
 
   index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
   index_type x, y, n, count, xcount, ycount;
-  index_type aystride_bytes, bystride_bytes;
+  index_type aystride_bytes, bystride_bytes, rystride_bytes;
 
   assert (GFC_DESCRIPTOR_RANK (a) == 2
           || GFC_DESCRIPTOR_RANK (b) == 2);
@@ -718,11 +720,13 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray,
 	 either as a row or a column matrix. We want both cases to
 	 work. */
       rxstride = rystride = GFC_DESCRIPTOR_STRIDE(retarray,0);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,0);
     }
   else
     {
       rxstride = GFC_DESCRIPTOR_STRIDE(retarray,0);
       rystride = GFC_DESCRIPTOR_STRIDE(retarray,1);
+      rystride_bytes = GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1);
     }
 
   if (GFC_DESCRIPTOR_RANK (a) == 1)
@@ -848,7 +852,7 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray,
 
       /* Parameter adjustments */
       c_dim1 = rystride;
-      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + GFC_DESCRIPTOR_STRIDE_BYTES(retarray,1));
+      PTR_DECREMENT_BYTES (c, sizeof(GFC_REAL_8) + rystride_bytes);
       a_dim1 = aystride;
       PTR_DECREMENT_BYTES (a, sizeof(GFC_REAL_8) + aystride_bytes);
       b_dim1 = bystride;


More information about the Gcc-cvs mailing list