https://gcc.gnu.org/g:89f367fa2c7c2d134016cf84a1de27ea96b0d0a9

commit 89f367fa2c7c2d134016cf84a1de27ea96b0d0a9
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Tue May 20 14:20:24 2025 +0200

    Correction partielle maxval_char_4

Diff:
---
 libgfortran/generated/maxloc0_16_s1.c  | 16 +++++-----
 libgfortran/generated/maxloc0_16_s4.c  | 16 +++++-----
 libgfortran/generated/maxloc0_4_s1.c   | 16 +++++-----
 libgfortran/generated/maxloc0_4_s4.c   | 16 +++++-----
 libgfortran/generated/maxloc0_8_s1.c   | 16 +++++-----
 libgfortran/generated/maxloc0_8_s4.c   | 16 +++++-----
 libgfortran/generated/maxloc1_16_i8.c  |  6 ++++
 libgfortran/generated/maxloc1_16_m16.c |  6 ++++
 libgfortran/generated/maxloc1_4_i16.c  |  6 ++++
 libgfortran/generated/maxloc1_4_i8.c   |  6 ++++
 libgfortran/generated/maxloc1_8_i16.c  |  6 ++++
 libgfortran/generated/maxloc1_8_i8.c   |  6 ++++
 libgfortran/generated/maxval1_s1.c     |  7 +++--
 libgfortran/generated/maxval1_s4.c     |  7 +++--
 libgfortran/generated/minloc0_16_s1.c  | 16 +++++-----
 libgfortran/generated/minloc0_16_s4.c  | 16 +++++-----
 libgfortran/generated/minloc0_4_s1.c   | 16 +++++-----
 libgfortran/generated/minloc0_4_s4.c   | 16 +++++-----
 libgfortran/generated/minloc0_8_s1.c   | 16 +++++-----
 libgfortran/generated/minloc0_8_s4.c   | 16 +++++-----
 libgfortran/generated/minval1_s1.c     |  7 +++--
 libgfortran/generated/minval1_s4.c     |  7 +++--
 libgfortran/m4/ifunction-s2.m4         | 57 ++++++++++++++++++----------------
 23 files changed, 182 insertions(+), 131 deletions(-)

diff --git a/libgfortran/generated/maxloc0_16_s1.c 
b/libgfortran/generated/maxloc0_16_s1.c
index 7056d7fca55b..47697cdd3795 100644
--- a/libgfortran/generated/maxloc0_16_s1.c
+++ b/libgfortran/generated/maxloc0_16_s1.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_1 *a, const GFC_UINTEGER_1 
*b, gfc_charlen_type
 
 }
 
-extern void maxloc0_16_s1 (gfc_array_i16 * const restrict retarray, 
+extern void maxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
        gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(maxloc0_16_s1);
 
 void
-maxloc0_16_s1 (gfc_array_i16 * const restrict retarray, 
+maxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
        gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ maxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
 }
 
 
-extern void mmaxloc0_16_s1 (gfc_array_i16 * const restrict, 
+extern void mmaxloc0_16_s1 (gfc_array_i16 * const restrict,
        gfc_array_s1 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(mmaxloc0_16_s1);
 
 void
-mmaxloc0_16_s1 (gfc_array_i16 * const restrict retarray, 
+mmaxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
        gfc_array_s1 * const restrict array,
        gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -176,7 +176,7 @@ mmaxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
 
   if (mask == NULL)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       maxloc0_16_s1 (retarray, array, back, len);
 #else
       maxloc0_16_s1 (retarray, array, len);
@@ -298,13 +298,13 @@ mmaxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
 }
 
 
-extern void smaxloc0_16_s1 (gfc_array_i16 * const restrict, 
+extern void smaxloc0_16_s1 (gfc_array_i16 * const restrict,
        gfc_array_s1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(smaxloc0_16_s1);
 
 void
-smaxloc0_16_s1 (gfc_array_i16 * const restrict retarray, 
+smaxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
        gfc_array_s1 * const restrict array,
        GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -316,7 +316,7 @@ smaxloc0_16_s1 (gfc_array_i16 * const restrict retarray,
 
   if (mask == NULL || *mask)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       maxloc0_16_s1 (retarray, array, back, len);
 #else
       maxloc0_16_s1 (retarray, array, len);
diff --git a/libgfortran/generated/maxloc0_16_s4.c 
b/libgfortran/generated/maxloc0_16_s4.c
index 095f8a169e93..d719520688b0 100644
--- a/libgfortran/generated/maxloc0_16_s4.c
+++ b/libgfortran/generated/maxloc0_16_s4.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_4 *a, const GFC_UINTEGER_4 
*b, gfc_charlen_type
 
 }
 
-extern void maxloc0_16_s4 (gfc_array_i16 * const restrict retarray, 
+extern void maxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
        gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(maxloc0_16_s4);
 
 void
-maxloc0_16_s4 (gfc_array_i16 * const restrict retarray, 
+maxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
        gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ maxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
 }
 
 
-extern void mmaxloc0_16_s4 (gfc_array_i16 * const restrict, 
+extern void mmaxloc0_16_s4 (gfc_array_i16 * const restrict,
        gfc_array_s4 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(mmaxloc0_16_s4);
 
 void
-mmaxloc0_16_s4 (gfc_array_i16 * const restrict retarray, 
+mmaxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
        gfc_array_s4 * const restrict array,
        gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -176,7 +176,7 @@ mmaxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
 
   if (mask == NULL)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       maxloc0_16_s4 (retarray, array, back, len);
 #else
       maxloc0_16_s4 (retarray, array, len);
@@ -298,13 +298,13 @@ mmaxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
 }
 
 
-extern void smaxloc0_16_s4 (gfc_array_i16 * const restrict, 
+extern void smaxloc0_16_s4 (gfc_array_i16 * const restrict,
        gfc_array_s4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(smaxloc0_16_s4);
 
 void
-smaxloc0_16_s4 (gfc_array_i16 * const restrict retarray, 
+smaxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
        gfc_array_s4 * const restrict array,
        GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -316,7 +316,7 @@ smaxloc0_16_s4 (gfc_array_i16 * const restrict retarray,
 
   if (mask == NULL || *mask)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       maxloc0_16_s4 (retarray, array, back, len);
 #else
       maxloc0_16_s4 (retarray, array, len);
diff --git a/libgfortran/generated/maxloc0_4_s1.c 
b/libgfortran/generated/maxloc0_4_s1.c
index a14058d17352..e47288992df4 100644
--- a/libgfortran/generated/maxloc0_4_s1.c
+++ b/libgfortran/generated/maxloc0_4_s1.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_1 *a, const GFC_UINTEGER_1 
*b, gfc_charlen_type
 
 }
 
-extern void maxloc0_4_s1 (gfc_array_i4 * const restrict retarray, 
+extern void maxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
        gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(maxloc0_4_s1);
 
 void
-maxloc0_4_s1 (gfc_array_i4 * const restrict retarray, 
+maxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
        gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ maxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
 }
 
 
-extern void mmaxloc0_4_s1 (gfc_array_i4 * const restrict, 
+extern void mmaxloc0_4_s1 (gfc_array_i4 * const restrict,
        gfc_array_s1 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(mmaxloc0_4_s1);
 
 void
-mmaxloc0_4_s1 (gfc_array_i4 * const restrict retarray, 
+mmaxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
        gfc_array_s1 * const restrict array,
        gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -176,7 +176,7 @@ mmaxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
 
   if (mask == NULL)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       maxloc0_4_s1 (retarray, array, back, len);
 #else
       maxloc0_4_s1 (retarray, array, len);
@@ -298,13 +298,13 @@ mmaxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
 }
 
 
-extern void smaxloc0_4_s1 (gfc_array_i4 * const restrict, 
+extern void smaxloc0_4_s1 (gfc_array_i4 * const restrict,
        gfc_array_s1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(smaxloc0_4_s1);
 
 void
-smaxloc0_4_s1 (gfc_array_i4 * const restrict retarray, 
+smaxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
        gfc_array_s1 * const restrict array,
        GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -316,7 +316,7 @@ smaxloc0_4_s1 (gfc_array_i4 * const restrict retarray,
 
   if (mask == NULL || *mask)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       maxloc0_4_s1 (retarray, array, back, len);
 #else
       maxloc0_4_s1 (retarray, array, len);
diff --git a/libgfortran/generated/maxloc0_4_s4.c 
b/libgfortran/generated/maxloc0_4_s4.c
index 6c2e2d3339d6..cbdf29901ecb 100644
--- a/libgfortran/generated/maxloc0_4_s4.c
+++ b/libgfortran/generated/maxloc0_4_s4.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_4 *a, const GFC_UINTEGER_4 
*b, gfc_charlen_type
 
 }
 
-extern void maxloc0_4_s4 (gfc_array_i4 * const restrict retarray, 
+extern void maxloc0_4_s4 (gfc_array_i4 * const restrict retarray,
        gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(maxloc0_4_s4);
 
 void
-maxloc0_4_s4 (gfc_array_i4 * const restrict retarray, 
+maxloc0_4_s4 (gfc_array_i4 * const restrict retarray,
        gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ maxloc0_4_s4 (gfc_array_i4 * const restrict retarray,
 }
 
 
-extern void mmaxloc0_4_s4 (gfc_array_i4 * const restrict, 
+extern void mmaxloc0_4_s4 (gfc_array_i4 * const restrict,
        gfc_array_s4 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(mmaxloc0_4_s4);
 
 void
-mmaxloc0_4_s4 (gfc_array_i4 * const restrict retarray, 
+mmaxloc0_4_s4 (gfc_array_i4 * const restrict retarray,
        gfc_array_s4 * const restrict array,
        gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -176,7 +176,7 @@ mmaxloc0_4_s4 (gfc_array_i4 * const restrict retarray,
 
   if (mask == NULL)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       maxloc0_4_s4 (retarray, array, back, len);
 #else
       maxloc0_4_s4 (retarray, array, len);
@@ -298,13 +298,13 @@ mmaxloc0_4_s4 (gfc_array_i4 * const restrict retarray,
 }
 
 
-extern void smaxloc0_4_s4 (gfc_array_i4 * const restrict, 
+extern void smaxloc0_4_s4 (gfc_array_i4 * const restrict,
        gfc_array_s4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(smaxloc0_4_s4);
 
 void
-smaxloc0_4_s4 (gfc_array_i4 * const restrict retarray, 
+smaxloc0_4_s4 (gfc_array_i4 * const restrict retarray,
        gfc_array_s4 * const restrict array,
        GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -316,7 +316,7 @@ smaxloc0_4_s4 (gfc_array_i4 * const restrict retarray,
 
   if (mask == NULL || *mask)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       maxloc0_4_s4 (retarray, array, back, len);
 #else
       maxloc0_4_s4 (retarray, array, len);
diff --git a/libgfortran/generated/maxloc0_8_s1.c 
b/libgfortran/generated/maxloc0_8_s1.c
index 85cfa97e3d8f..c819b1ee4724 100644
--- a/libgfortran/generated/maxloc0_8_s1.c
+++ b/libgfortran/generated/maxloc0_8_s1.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_1 *a, const GFC_UINTEGER_1 
*b, gfc_charlen_type
 
 }
 
-extern void maxloc0_8_s1 (gfc_array_i8 * const restrict retarray, 
+extern void maxloc0_8_s1 (gfc_array_i8 * const restrict retarray,
        gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(maxloc0_8_s1);
 
 void
-maxloc0_8_s1 (gfc_array_i8 * const restrict retarray, 
+maxloc0_8_s1 (gfc_array_i8 * const restrict retarray,
        gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ maxloc0_8_s1 (gfc_array_i8 * const restrict retarray,
 }
 
 
-extern void mmaxloc0_8_s1 (gfc_array_i8 * const restrict, 
+extern void mmaxloc0_8_s1 (gfc_array_i8 * const restrict,
        gfc_array_s1 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(mmaxloc0_8_s1);
 
 void
-mmaxloc0_8_s1 (gfc_array_i8 * const restrict retarray, 
+mmaxloc0_8_s1 (gfc_array_i8 * const restrict retarray,
        gfc_array_s1 * const restrict array,
        gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -176,7 +176,7 @@ mmaxloc0_8_s1 (gfc_array_i8 * const restrict retarray,
 
   if (mask == NULL)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       maxloc0_8_s1 (retarray, array, back, len);
 #else
       maxloc0_8_s1 (retarray, array, len);
@@ -298,13 +298,13 @@ mmaxloc0_8_s1 (gfc_array_i8 * const restrict retarray,
 }
 
 
-extern void smaxloc0_8_s1 (gfc_array_i8 * const restrict, 
+extern void smaxloc0_8_s1 (gfc_array_i8 * const restrict,
        gfc_array_s1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(smaxloc0_8_s1);
 
 void
-smaxloc0_8_s1 (gfc_array_i8 * const restrict retarray, 
+smaxloc0_8_s1 (gfc_array_i8 * const restrict retarray,
        gfc_array_s1 * const restrict array,
        GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -316,7 +316,7 @@ smaxloc0_8_s1 (gfc_array_i8 * const restrict retarray,
 
   if (mask == NULL || *mask)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       maxloc0_8_s1 (retarray, array, back, len);
 #else
       maxloc0_8_s1 (retarray, array, len);
diff --git a/libgfortran/generated/maxloc0_8_s4.c 
b/libgfortran/generated/maxloc0_8_s4.c
index 6634d7a9a4bb..f390bb64e44b 100644
--- a/libgfortran/generated/maxloc0_8_s4.c
+++ b/libgfortran/generated/maxloc0_8_s4.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_4 *a, const GFC_UINTEGER_4 
*b, gfc_charlen_type
 
 }
 
-extern void maxloc0_8_s4 (gfc_array_i8 * const restrict retarray, 
+extern void maxloc0_8_s4 (gfc_array_i8 * const restrict retarray,
        gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(maxloc0_8_s4);
 
 void
-maxloc0_8_s4 (gfc_array_i8 * const restrict retarray, 
+maxloc0_8_s4 (gfc_array_i8 * const restrict retarray,
        gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ maxloc0_8_s4 (gfc_array_i8 * const restrict retarray,
 }
 
 
-extern void mmaxloc0_8_s4 (gfc_array_i8 * const restrict, 
+extern void mmaxloc0_8_s4 (gfc_array_i8 * const restrict,
        gfc_array_s4 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(mmaxloc0_8_s4);
 
 void
-mmaxloc0_8_s4 (gfc_array_i8 * const restrict retarray, 
+mmaxloc0_8_s4 (gfc_array_i8 * const restrict retarray,
        gfc_array_s4 * const restrict array,
        gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -176,7 +176,7 @@ mmaxloc0_8_s4 (gfc_array_i8 * const restrict retarray,
 
   if (mask == NULL)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       maxloc0_8_s4 (retarray, array, back, len);
 #else
       maxloc0_8_s4 (retarray, array, len);
@@ -298,13 +298,13 @@ mmaxloc0_8_s4 (gfc_array_i8 * const restrict retarray,
 }
 
 
-extern void smaxloc0_8_s4 (gfc_array_i8 * const restrict, 
+extern void smaxloc0_8_s4 (gfc_array_i8 * const restrict,
        gfc_array_s4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(smaxloc0_8_s4);
 
 void
-smaxloc0_8_s4 (gfc_array_i8 * const restrict retarray, 
+smaxloc0_8_s4 (gfc_array_i8 * const restrict retarray,
        gfc_array_s4 * const restrict array,
        GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -316,7 +316,7 @@ smaxloc0_8_s4 (gfc_array_i8 * const restrict retarray,
 
   if (mask == NULL || *mask)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       maxloc0_8_s4 (retarray, array, back, len);
 #else
       maxloc0_8_s4 (retarray, array, len);
diff --git a/libgfortran/generated/maxloc1_16_i8.c 
b/libgfortran/generated/maxloc1_16_i8.c
index 6eb37093f425..16dc1d248990 100644
--- a/libgfortran/generated/maxloc1_16_i8.c
+++ b/libgfortran/generated/maxloc1_16_i8.c
@@ -103,6 +103,8 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_16);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_16);
 
       alloc_size = GFC_DESCRIPTOR_SPACING(retarray,rank-1) * extent[rank-1];
 
@@ -326,6 +328,8 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_16);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_16);
 
       retarray->base_addr = xmalloc (alloc_size);
       if (alloc_size == 0)
@@ -532,6 +536,8 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_16);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_16);
 
       alloc_size = GFC_DESCRIPTOR_SPACING(retarray,rank-1) * extent[rank-1];
 
diff --git a/libgfortran/generated/maxloc1_16_m16.c 
b/libgfortran/generated/maxloc1_16_m16.c
index 486ee43a69d3..16784df3cae9 100644
--- a/libgfortran/generated/maxloc1_16_m16.c
+++ b/libgfortran/generated/maxloc1_16_m16.c
@@ -103,6 +103,8 @@ maxloc1_16_m16 (gfc_array_i16 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_16);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_16);
 
       alloc_size = GFC_DESCRIPTOR_SPACING(retarray,rank-1) * extent[rank-1];
 
@@ -326,6 +328,8 @@ mmaxloc1_16_m16 (gfc_array_i16 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_16);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_16);
 
       retarray->base_addr = xmalloc (alloc_size);
       if (alloc_size == 0)
@@ -532,6 +536,8 @@ smaxloc1_16_m16 (gfc_array_i16 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_16);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_16);
 
       alloc_size = GFC_DESCRIPTOR_SPACING(retarray,rank-1) * extent[rank-1];
 
diff --git a/libgfortran/generated/maxloc1_4_i16.c 
b/libgfortran/generated/maxloc1_4_i16.c
index cb6ca363ee20..5135174da0aa 100644
--- a/libgfortran/generated/maxloc1_4_i16.c
+++ b/libgfortran/generated/maxloc1_4_i16.c
@@ -103,6 +103,8 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_4);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_4);
 
       alloc_size = GFC_DESCRIPTOR_SPACING(retarray,rank-1) * extent[rank-1];
 
@@ -326,6 +328,8 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_4);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_4);
 
       retarray->base_addr = xmalloc (alloc_size);
       if (alloc_size == 0)
@@ -532,6 +536,8 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_4);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_4);
 
       alloc_size = GFC_DESCRIPTOR_SPACING(retarray,rank-1) * extent[rank-1];
 
diff --git a/libgfortran/generated/maxloc1_4_i8.c 
b/libgfortran/generated/maxloc1_4_i8.c
index 56eb1421c7d0..c48f060a677b 100644
--- a/libgfortran/generated/maxloc1_4_i8.c
+++ b/libgfortran/generated/maxloc1_4_i8.c
@@ -103,6 +103,8 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_4);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_4);
 
       alloc_size = GFC_DESCRIPTOR_SPACING(retarray,rank-1) * extent[rank-1];
 
@@ -326,6 +328,8 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_4);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_4);
 
       retarray->base_addr = xmalloc (alloc_size);
       if (alloc_size == 0)
@@ -532,6 +536,8 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_4);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_4);
 
       alloc_size = GFC_DESCRIPTOR_SPACING(retarray,rank-1) * extent[rank-1];
 
diff --git a/libgfortran/generated/maxloc1_8_i16.c 
b/libgfortran/generated/maxloc1_8_i16.c
index a621193dedaa..04ffb8b04a2d 100644
--- a/libgfortran/generated/maxloc1_8_i16.c
+++ b/libgfortran/generated/maxloc1_8_i16.c
@@ -103,6 +103,8 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_8);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_8);
 
       alloc_size = GFC_DESCRIPTOR_SPACING(retarray,rank-1) * extent[rank-1];
 
@@ -326,6 +328,8 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_8);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_8);
 
       retarray->base_addr = xmalloc (alloc_size);
       if (alloc_size == 0)
@@ -532,6 +536,8 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_8);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_8);
 
       alloc_size = GFC_DESCRIPTOR_SPACING(retarray,rank-1) * extent[rank-1];
 
diff --git a/libgfortran/generated/maxloc1_8_i8.c 
b/libgfortran/generated/maxloc1_8_i8.c
index fc6fedb4d4f8..11dddf5527b7 100644
--- a/libgfortran/generated/maxloc1_8_i8.c
+++ b/libgfortran/generated/maxloc1_8_i8.c
@@ -103,6 +103,8 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_8);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_8);
 
       alloc_size = GFC_DESCRIPTOR_SPACING(retarray,rank-1) * extent[rank-1];
 
@@ -326,6 +328,8 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_8);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_8);
 
       retarray->base_addr = xmalloc (alloc_size);
       if (alloc_size == 0)
@@ -532,6 +536,8 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
 
       retarray->offset = 0;
       retarray->dtype.rank = rank;
+      GFC_DESCRIPTOR_SIZE (retarray) = sizeof (GFC_INTEGER_8);
+      GFC_DESCRIPTOR_SPAN (retarray) = sizeof (GFC_INTEGER_8);
 
       alloc_size = GFC_DESCRIPTOR_SPACING(retarray,rank-1) * extent[rank-1];
 
diff --git a/libgfortran/generated/maxval1_s1.c 
b/libgfortran/generated/maxval1_s1.c
index 016bf037080f..e4c487e3cb77 100644
--- a/libgfortran/generated/maxval1_s1.c
+++ b/libgfortran/generated/maxval1_s1.c
@@ -158,13 +158,14 @@ maxval1_s1 (gfc_array_s1 * const restrict retarray,
          memset (dest, 0, sizeof (*dest) * string_len);
        else
          {
-           for (n = 0; n < len; n++, src = (GFC_UINTEGER_1*) (((char*) src) + 
delta))
+           for (n = 0; n < len; n++)
              {
 
                if (compare_fcn (src, retval, string_len) > 0)
                  {
                    retval = src;
                  }
+               src = (GFC_UINTEGER_1*) (((char*)src) + delta);
              }
            
            memcpy (dest, retval, sizeof (*dest) * string_len);
@@ -350,7 +351,7 @@ mmaxval1_s1 (gfc_array_s1 * const restrict retarray,
        const GFC_UINTEGER_1 *retval;
        memset (dest, 0, sizeof (*dest) * string_len);
        retval = dest;
-       for (n = 0; n < len; n++, msrc += mdelta, src = (GFC_UINTEGER_1*) 
(((char*) src) + delta))
+       for (n = 0; n < len; n++)
          {
 
                if (*msrc)
@@ -366,6 +367,8 @@ mmaxval1_s1 (gfc_array_s1 * const restrict retarray,
                    retval = src;
                  }
              
+           src = (GFC_UINTEGER_1*) (((char*)src) + delta);
+           msrc += mdelta;
          }
        memcpy (dest, retval, sizeof (*dest) * string_len);
       }
diff --git a/libgfortran/generated/maxval1_s4.c 
b/libgfortran/generated/maxval1_s4.c
index b307fc5758e2..686e18276a12 100644
--- a/libgfortran/generated/maxval1_s4.c
+++ b/libgfortran/generated/maxval1_s4.c
@@ -158,13 +158,14 @@ maxval1_s4 (gfc_array_s4 * const restrict retarray,
          memset (dest, 0, sizeof (*dest) * string_len);
        else
          {
-           for (n = 0; n < len; n++, src = (GFC_UINTEGER_4*) (((char*) src) + 
delta))
+           for (n = 0; n < len; n++)
              {
 
                if (compare_fcn (src, retval, string_len) > 0)
                  {
                    retval = src;
                  }
+               src = (GFC_UINTEGER_4*) (((char*)src) + delta);
              }
            
            memcpy (dest, retval, sizeof (*dest) * string_len);
@@ -350,7 +351,7 @@ mmaxval1_s4 (gfc_array_s4 * const restrict retarray,
        const GFC_UINTEGER_4 *retval;
        memset (dest, 0, sizeof (*dest) * string_len);
        retval = dest;
-       for (n = 0; n < len; n++, msrc += mdelta, src = (GFC_UINTEGER_4*) 
(((char*) src) + delta))
+       for (n = 0; n < len; n++)
          {
 
                if (*msrc)
@@ -366,6 +367,8 @@ mmaxval1_s4 (gfc_array_s4 * const restrict retarray,
                    retval = src;
                  }
              
+           src = (GFC_UINTEGER_4*) (((char*)src) + delta);
+           msrc += mdelta;
          }
        memcpy (dest, retval, sizeof (*dest) * string_len);
       }
diff --git a/libgfortran/generated/minloc0_16_s1.c 
b/libgfortran/generated/minloc0_16_s1.c
index c5f600de2f82..58b3cea87d98 100644
--- a/libgfortran/generated/minloc0_16_s1.c
+++ b/libgfortran/generated/minloc0_16_s1.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_1 *a, const GFC_UINTEGER_1 
*b, gfc_charlen_type
 
 }
 
-extern void minloc0_16_s1 (gfc_array_i16 * const restrict retarray, 
+extern void minloc0_16_s1 (gfc_array_i16 * const restrict retarray,
        gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(minloc0_16_s1);
 
 void
-minloc0_16_s1 (gfc_array_i16 * const restrict retarray, 
+minloc0_16_s1 (gfc_array_i16 * const restrict retarray,
        gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ minloc0_16_s1 (gfc_array_i16 * const restrict retarray,
 }
 
 
-extern void mminloc0_16_s1 (gfc_array_i16 * const restrict, 
+extern void mminloc0_16_s1 (gfc_array_i16 * const restrict,
        gfc_array_s1 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(mminloc0_16_s1);
 
 void
-mminloc0_16_s1 (gfc_array_i16 * const restrict retarray, 
+mminloc0_16_s1 (gfc_array_i16 * const restrict retarray,
        gfc_array_s1 * const restrict array,
        gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -176,7 +176,7 @@ mminloc0_16_s1 (gfc_array_i16 * const restrict retarray,
 
   if (mask == NULL)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       minloc0_16_s1 (retarray, array, back, len);
 #else
       minloc0_16_s1 (retarray, array, len);
@@ -298,13 +298,13 @@ mminloc0_16_s1 (gfc_array_i16 * const restrict retarray,
 }
 
 
-extern void sminloc0_16_s1 (gfc_array_i16 * const restrict, 
+extern void sminloc0_16_s1 (gfc_array_i16 * const restrict,
        gfc_array_s1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(sminloc0_16_s1);
 
 void
-sminloc0_16_s1 (gfc_array_i16 * const restrict retarray, 
+sminloc0_16_s1 (gfc_array_i16 * const restrict retarray,
        gfc_array_s1 * const restrict array,
        GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -316,7 +316,7 @@ sminloc0_16_s1 (gfc_array_i16 * const restrict retarray,
 
   if (mask == NULL || *mask)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       minloc0_16_s1 (retarray, array, back, len);
 #else
       minloc0_16_s1 (retarray, array, len);
diff --git a/libgfortran/generated/minloc0_16_s4.c 
b/libgfortran/generated/minloc0_16_s4.c
index bd1c5f551ef8..e00d308bb4e7 100644
--- a/libgfortran/generated/minloc0_16_s4.c
+++ b/libgfortran/generated/minloc0_16_s4.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_4 *a, const GFC_UINTEGER_4 
*b, gfc_charlen_type
 
 }
 
-extern void minloc0_16_s4 (gfc_array_i16 * const restrict retarray, 
+extern void minloc0_16_s4 (gfc_array_i16 * const restrict retarray,
        gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(minloc0_16_s4);
 
 void
-minloc0_16_s4 (gfc_array_i16 * const restrict retarray, 
+minloc0_16_s4 (gfc_array_i16 * const restrict retarray,
        gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ minloc0_16_s4 (gfc_array_i16 * const restrict retarray,
 }
 
 
-extern void mminloc0_16_s4 (gfc_array_i16 * const restrict, 
+extern void mminloc0_16_s4 (gfc_array_i16 * const restrict,
        gfc_array_s4 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(mminloc0_16_s4);
 
 void
-mminloc0_16_s4 (gfc_array_i16 * const restrict retarray, 
+mminloc0_16_s4 (gfc_array_i16 * const restrict retarray,
        gfc_array_s4 * const restrict array,
        gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -176,7 +176,7 @@ mminloc0_16_s4 (gfc_array_i16 * const restrict retarray,
 
   if (mask == NULL)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       minloc0_16_s4 (retarray, array, back, len);
 #else
       minloc0_16_s4 (retarray, array, len);
@@ -298,13 +298,13 @@ mminloc0_16_s4 (gfc_array_i16 * const restrict retarray,
 }
 
 
-extern void sminloc0_16_s4 (gfc_array_i16 * const restrict, 
+extern void sminloc0_16_s4 (gfc_array_i16 * const restrict,
        gfc_array_s4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(sminloc0_16_s4);
 
 void
-sminloc0_16_s4 (gfc_array_i16 * const restrict retarray, 
+sminloc0_16_s4 (gfc_array_i16 * const restrict retarray,
        gfc_array_s4 * const restrict array,
        GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -316,7 +316,7 @@ sminloc0_16_s4 (gfc_array_i16 * const restrict retarray,
 
   if (mask == NULL || *mask)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       minloc0_16_s4 (retarray, array, back, len);
 #else
       minloc0_16_s4 (retarray, array, len);
diff --git a/libgfortran/generated/minloc0_4_s1.c 
b/libgfortran/generated/minloc0_4_s1.c
index 001693a99eeb..6bd39fe20adf 100644
--- a/libgfortran/generated/minloc0_4_s1.c
+++ b/libgfortran/generated/minloc0_4_s1.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_1 *a, const GFC_UINTEGER_1 
*b, gfc_charlen_type
 
 }
 
-extern void minloc0_4_s1 (gfc_array_i4 * const restrict retarray, 
+extern void minloc0_4_s1 (gfc_array_i4 * const restrict retarray,
        gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(minloc0_4_s1);
 
 void
-minloc0_4_s1 (gfc_array_i4 * const restrict retarray, 
+minloc0_4_s1 (gfc_array_i4 * const restrict retarray,
        gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ minloc0_4_s1 (gfc_array_i4 * const restrict retarray,
 }
 
 
-extern void mminloc0_4_s1 (gfc_array_i4 * const restrict, 
+extern void mminloc0_4_s1 (gfc_array_i4 * const restrict,
        gfc_array_s1 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(mminloc0_4_s1);
 
 void
-mminloc0_4_s1 (gfc_array_i4 * const restrict retarray, 
+mminloc0_4_s1 (gfc_array_i4 * const restrict retarray,
        gfc_array_s1 * const restrict array,
        gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -176,7 +176,7 @@ mminloc0_4_s1 (gfc_array_i4 * const restrict retarray,
 
   if (mask == NULL)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       minloc0_4_s1 (retarray, array, back, len);
 #else
       minloc0_4_s1 (retarray, array, len);
@@ -298,13 +298,13 @@ mminloc0_4_s1 (gfc_array_i4 * const restrict retarray,
 }
 
 
-extern void sminloc0_4_s1 (gfc_array_i4 * const restrict, 
+extern void sminloc0_4_s1 (gfc_array_i4 * const restrict,
        gfc_array_s1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(sminloc0_4_s1);
 
 void
-sminloc0_4_s1 (gfc_array_i4 * const restrict retarray, 
+sminloc0_4_s1 (gfc_array_i4 * const restrict retarray,
        gfc_array_s1 * const restrict array,
        GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -316,7 +316,7 @@ sminloc0_4_s1 (gfc_array_i4 * const restrict retarray,
 
   if (mask == NULL || *mask)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       minloc0_4_s1 (retarray, array, back, len);
 #else
       minloc0_4_s1 (retarray, array, len);
diff --git a/libgfortran/generated/minloc0_4_s4.c 
b/libgfortran/generated/minloc0_4_s4.c
index ad06948320a2..f38063ddc814 100644
--- a/libgfortran/generated/minloc0_4_s4.c
+++ b/libgfortran/generated/minloc0_4_s4.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_4 *a, const GFC_UINTEGER_4 
*b, gfc_charlen_type
 
 }
 
-extern void minloc0_4_s4 (gfc_array_i4 * const restrict retarray, 
+extern void minloc0_4_s4 (gfc_array_i4 * const restrict retarray,
        gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(minloc0_4_s4);
 
 void
-minloc0_4_s4 (gfc_array_i4 * const restrict retarray, 
+minloc0_4_s4 (gfc_array_i4 * const restrict retarray,
        gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ minloc0_4_s4 (gfc_array_i4 * const restrict retarray,
 }
 
 
-extern void mminloc0_4_s4 (gfc_array_i4 * const restrict, 
+extern void mminloc0_4_s4 (gfc_array_i4 * const restrict,
        gfc_array_s4 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(mminloc0_4_s4);
 
 void
-mminloc0_4_s4 (gfc_array_i4 * const restrict retarray, 
+mminloc0_4_s4 (gfc_array_i4 * const restrict retarray,
        gfc_array_s4 * const restrict array,
        gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -176,7 +176,7 @@ mminloc0_4_s4 (gfc_array_i4 * const restrict retarray,
 
   if (mask == NULL)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       minloc0_4_s4 (retarray, array, back, len);
 #else
       minloc0_4_s4 (retarray, array, len);
@@ -298,13 +298,13 @@ mminloc0_4_s4 (gfc_array_i4 * const restrict retarray,
 }
 
 
-extern void sminloc0_4_s4 (gfc_array_i4 * const restrict, 
+extern void sminloc0_4_s4 (gfc_array_i4 * const restrict,
        gfc_array_s4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(sminloc0_4_s4);
 
 void
-sminloc0_4_s4 (gfc_array_i4 * const restrict retarray, 
+sminloc0_4_s4 (gfc_array_i4 * const restrict retarray,
        gfc_array_s4 * const restrict array,
        GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -316,7 +316,7 @@ sminloc0_4_s4 (gfc_array_i4 * const restrict retarray,
 
   if (mask == NULL || *mask)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       minloc0_4_s4 (retarray, array, back, len);
 #else
       minloc0_4_s4 (retarray, array, len);
diff --git a/libgfortran/generated/minloc0_8_s1.c 
b/libgfortran/generated/minloc0_8_s1.c
index 95929c742ee2..f4231273501a 100644
--- a/libgfortran/generated/minloc0_8_s1.c
+++ b/libgfortran/generated/minloc0_8_s1.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_1 *a, const GFC_UINTEGER_1 
*b, gfc_charlen_type
 
 }
 
-extern void minloc0_8_s1 (gfc_array_i8 * const restrict retarray, 
+extern void minloc0_8_s1 (gfc_array_i8 * const restrict retarray,
        gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(minloc0_8_s1);
 
 void
-minloc0_8_s1 (gfc_array_i8 * const restrict retarray, 
+minloc0_8_s1 (gfc_array_i8 * const restrict retarray,
        gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ minloc0_8_s1 (gfc_array_i8 * const restrict retarray,
 }
 
 
-extern void mminloc0_8_s1 (gfc_array_i8 * const restrict, 
+extern void mminloc0_8_s1 (gfc_array_i8 * const restrict,
        gfc_array_s1 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(mminloc0_8_s1);
 
 void
-mminloc0_8_s1 (gfc_array_i8 * const restrict retarray, 
+mminloc0_8_s1 (gfc_array_i8 * const restrict retarray,
        gfc_array_s1 * const restrict array,
        gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -176,7 +176,7 @@ mminloc0_8_s1 (gfc_array_i8 * const restrict retarray,
 
   if (mask == NULL)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       minloc0_8_s1 (retarray, array, back, len);
 #else
       minloc0_8_s1 (retarray, array, len);
@@ -298,13 +298,13 @@ mminloc0_8_s1 (gfc_array_i8 * const restrict retarray,
 }
 
 
-extern void sminloc0_8_s1 (gfc_array_i8 * const restrict, 
+extern void sminloc0_8_s1 (gfc_array_i8 * const restrict,
        gfc_array_s1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(sminloc0_8_s1);
 
 void
-sminloc0_8_s1 (gfc_array_i8 * const restrict retarray, 
+sminloc0_8_s1 (gfc_array_i8 * const restrict retarray,
        gfc_array_s1 * const restrict array,
        GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -316,7 +316,7 @@ sminloc0_8_s1 (gfc_array_i8 * const restrict retarray,
 
   if (mask == NULL || *mask)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       minloc0_8_s1 (retarray, array, back, len);
 #else
       minloc0_8_s1 (retarray, array, len);
diff --git a/libgfortran/generated/minloc0_8_s4.c 
b/libgfortran/generated/minloc0_8_s4.c
index 470025cda31b..42cb0fbc6c51 100644
--- a/libgfortran/generated/minloc0_8_s4.c
+++ b/libgfortran/generated/minloc0_8_s4.c
@@ -44,12 +44,12 @@ compare_fcn (const GFC_UINTEGER_4 *a, const GFC_UINTEGER_4 
*b, gfc_charlen_type
 
 }
 
-extern void minloc0_8_s4 (gfc_array_i8 * const restrict retarray, 
+extern void minloc0_8_s4 (gfc_array_i8 * const restrict retarray,
        gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len);
 export_proto(minloc0_8_s4);
 
 void
-minloc0_8_s4 (gfc_array_i8 * const restrict retarray, 
+minloc0_8_s4 (gfc_array_i8 * const restrict retarray,
        gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, 
gfc_charlen_type len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
@@ -151,13 +151,13 @@ minloc0_8_s4 (gfc_array_i8 * const restrict retarray,
 }
 
 
-extern void mminloc0_8_s4 (gfc_array_i8 * const restrict, 
+extern void mminloc0_8_s4 (gfc_array_i8 * const restrict,
        gfc_array_s4 * const restrict, gfc_array_l1 * const restrict , 
GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(mminloc0_8_s4);
 
 void
-mminloc0_8_s4 (gfc_array_i8 * const restrict retarray, 
+mminloc0_8_s4 (gfc_array_i8 * const restrict retarray,
        gfc_array_s4 * const restrict array,
        gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -176,7 +176,7 @@ mminloc0_8_s4 (gfc_array_i8 * const restrict retarray,
 
   if (mask == NULL)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       minloc0_8_s4 (retarray, array, back, len);
 #else
       minloc0_8_s4 (retarray, array, len);
@@ -298,13 +298,13 @@ mminloc0_8_s4 (gfc_array_i8 * const restrict retarray,
 }
 
 
-extern void sminloc0_8_s4 (gfc_array_i8 * const restrict, 
+extern void sminloc0_8_s4 (gfc_array_i8 * const restrict,
        gfc_array_s4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4 back,
        gfc_charlen_type len);
 export_proto(sminloc0_8_s4);
 
 void
-sminloc0_8_s4 (gfc_array_i8 * const restrict retarray, 
+sminloc0_8_s4 (gfc_array_i8 * const restrict retarray,
        gfc_array_s4 * const restrict array,
        GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back,
        gfc_charlen_type len)
@@ -316,7 +316,7 @@ sminloc0_8_s4 (gfc_array_i8 * const restrict retarray,
 
   if (mask == NULL || *mask)
     {
-#ifdef HAVE_BACK_ARG    
+#ifdef HAVE_BACK_ARG
       minloc0_8_s4 (retarray, array, back, len);
 #else
       minloc0_8_s4 (retarray, array, len);
diff --git a/libgfortran/generated/minval1_s1.c 
b/libgfortran/generated/minval1_s1.c
index c2638e671e40..00f4473c3b45 100644
--- a/libgfortran/generated/minval1_s1.c
+++ b/libgfortran/generated/minval1_s1.c
@@ -158,13 +158,14 @@ minval1_s1 (gfc_array_s1 * const restrict retarray,
          memset (dest, 255, sizeof (*dest) * string_len);
        else
          {
-           for (n = 0; n < len; n++, src = (GFC_UINTEGER_1*) (((char*) src) + 
delta))
+           for (n = 0; n < len; n++)
              {
 
                if (compare_fcn (src, retval, string_len) < 0)
                  {
                    retval = src;
                  }
+               src = (GFC_UINTEGER_1*) (((char*)src) + delta);
              }
            
            memcpy (dest, retval, sizeof (*dest) * string_len);
@@ -350,7 +351,7 @@ mminval1_s1 (gfc_array_s1 * const restrict retarray,
        const GFC_UINTEGER_1 *retval;
        memset (dest, 255, sizeof (*dest) * string_len);
        retval = dest;
-       for (n = 0; n < len; n++, msrc += mdelta, src = (GFC_UINTEGER_1*) 
(((char*) src) + delta))
+       for (n = 0; n < len; n++)
          {
 
                if (*msrc)
@@ -366,6 +367,8 @@ mminval1_s1 (gfc_array_s1 * const restrict retarray,
                    retval = src;
                  }
              
+           src = (GFC_UINTEGER_1*) (((char*)src) + delta);
+           msrc += mdelta;
          }
        memcpy (dest, retval, sizeof (*dest) * string_len);
       }
diff --git a/libgfortran/generated/minval1_s4.c 
b/libgfortran/generated/minval1_s4.c
index a44aa01c51d8..1ecbc7b75f25 100644
--- a/libgfortran/generated/minval1_s4.c
+++ b/libgfortran/generated/minval1_s4.c
@@ -158,13 +158,14 @@ minval1_s4 (gfc_array_s4 * const restrict retarray,
          memset (dest, 255, sizeof (*dest) * string_len);
        else
          {
-           for (n = 0; n < len; n++, src = (GFC_UINTEGER_4*) (((char*) src) + 
delta))
+           for (n = 0; n < len; n++)
              {
 
                if (compare_fcn (src, retval, string_len) < 0)
                  {
                    retval = src;
                  }
+               src = (GFC_UINTEGER_4*) (((char*)src) + delta);
              }
            
            memcpy (dest, retval, sizeof (*dest) * string_len);
@@ -350,7 +351,7 @@ mminval1_s4 (gfc_array_s4 * const restrict retarray,
        const GFC_UINTEGER_4 *retval;
        memset (dest, 255, sizeof (*dest) * string_len);
        retval = dest;
-       for (n = 0; n < len; n++, msrc += mdelta, src = (GFC_UINTEGER_4*) 
(((char*) src) + delta))
+       for (n = 0; n < len; n++)
          {
 
                if (*msrc)
@@ -366,6 +367,8 @@ mminval1_s4 (gfc_array_s4 * const restrict retarray,
                    retval = src;
                  }
              
+           src = (GFC_UINTEGER_4*) (((char*)src) + delta);
+           msrc += mdelta;
          }
        memcpy (dest, retval, sizeof (*dest) * string_len);
       }
diff --git a/libgfortran/m4/ifunction-s2.m4 b/libgfortran/m4/ifunction-s2.m4
index b96fe79a5d46..1b8ef50dba9e 100644
--- a/libgfortran/m4/ifunction-s2.m4
+++ b/libgfortran/m4/ifunction-s2.m4
@@ -30,22 +30,22 @@ compare_fcn (const atype_name *a, const atype_name *b, 
gfc_charlen_type n)
     return memcmp_char4 (a, b, n);
 }
 
-extern void name`'rtype_qual`_'atype_code (rtype * const restrict,
-        gfc_charlen_type, atype * const restrict,
+extern void 'name`'rtype_qual`_'atype_code` ('rtype` * const restrict,
+        gfc_charlen_type, 'atype` * const restrict,
        const index_type * const restrict, gfc_charlen_type);
-export_proto(name`'rtype_qual`_'atype_code);
+export_proto('name`'rtype_qual`_'atype_code`);
 
 void
-name`'rtype_qual`_'atype_code (rtype * const restrict retarray, 
-       gfc_charlen_type xlen, atype * const restrict array, 
+'name`'rtype_qual`_'atype_code` ('rtype` * const restrict retarray, 
+       gfc_charlen_type xlen, 'atype` * const restrict array, 
        const index_type * const restrict pdim, gfc_charlen_type string_len)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
   index_type sspacing[GFC_MAX_DIMENSIONS];
   index_type dspacing[GFC_MAX_DIMENSIONS];
-  const atype_name * restrict base;
-  rtype_name * restrict dest;
+  const 'atype_name` * restrict base;
+  'rtype_name` * restrict dest;
   index_type rank;
   index_type n;
   index_type len;
@@ -138,7 +138,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict 
retarray,
   continue_loop = 1;
   while (continue_loop)
     {
-      const atype_name * restrict src;
+      const 'atype_name` * restrict src;
       src = base;
       {
 ')dnl
@@ -147,11 +147,12 @@ define(START_ARRAY_BLOCK,
          memset (dest, '$1`, sizeof (*dest) * string_len);
        else
          {
-           for (n = 0; n < len; n++, src = ('atype_name`*) (((char*) src) + 
delta))
+           for (n = 0; n < len; n++)
              {
 ')dnl
 define(FINISH_ARRAY_FUNCTION,
-`            }
+`              src = ('atype_name`*) (((char*)src) + delta);
+             }
            '$1`
            memcpy (dest, retval, sizeof (*dest) * string_len);
          }
@@ -188,14 +189,14 @@ define(FINISH_ARRAY_FUNCTION,
 }')dnl
 define(START_MASKED_ARRAY_FUNCTION,
 `
-extern void `m'name`'rtype_qual`_'atype_code (rtype * const restrict,
-        gfc_charlen_type, atype * const restrict,
+extern void m'name`'rtype_qual`_'atype_code` ('rtype` * const restrict,
+        gfc_charlen_type, 'atype` * const restrict,
        const index_type * const restrict,
        gfc_array_l1 * const restrict, gfc_charlen_type);
-export_proto(`m'name`'rtype_qual`_'atype_code);
+export_proto(m'name`'rtype_qual`_'atype_code`);
 
 void
-`m'name`'rtype_qual`_'atype_code (rtype * const restrict retarray, 
+m'name`'rtype_qual`_'atype_code` ('rtype` * const restrict retarray, 
        gfc_charlen_type xlen, atype * const restrict array, 
        const index_type * const restrict pdim,
        gfc_array_l1 * const restrict mask,
@@ -207,8 +208,8 @@ void
   index_type sspacing[GFC_MAX_DIMENSIONS];
   index_type dspacing[GFC_MAX_DIMENSIONS];
   index_type mspacing[GFC_MAX_DIMENSIONS];
-  rtype_name * restrict dest;
-  const atype_name * restrict base;
+  'rtype_name` * restrict dest;
+  const 'atype_name` * restrict base;
   const GFC_LOGICAL_1 * restrict mbase;
   index_type rank;
   index_type dim;
@@ -220,7 +221,7 @@ void
 
   if (mask == NULL)
     {
-      name`'rtype_qual`_'atype_code (retarray, xlen, array, pdim, string_len);
+      'name`'rtype_qual`_'atype_code` (retarray, xlen, array, pdim, 
string_len);
       return;
     }
 
@@ -326,7 +327,7 @@ void
 
   while (base)
     {
-      const atype_name * restrict src;
+      const 'atype_name` * restrict src;
       const GFC_LOGICAL_1 * restrict msrc;
 
       src = base;
@@ -334,11 +335,13 @@ void
       {
 ')dnl
 define(START_MASKED_ARRAY_BLOCK,
-`      for (n = 0; n < len; n++, msrc += mdelta, src = ('atype_name`*) 
(((char*) src) + delta))
+`      for (n = 0; n < len; n++)
          {
 ')dnl
 define(FINISH_MASKED_ARRAY_FUNCTION,
-`        }
+`          src = ('atype_name`*) (((char*)src) + delta);
+           msrc += mdelta;
+         }
        memcpy (dest, retval, sizeof (*dest) * string_len);
       }
       /* Advance to the next element.  */
@@ -376,16 +379,16 @@ define(FINISH_MASKED_ARRAY_FUNCTION,
 }')dnl
 define(SCALAR_ARRAY_FUNCTION,
 `
-void `s'name`'rtype_qual`_'atype_code (rtype * const restrict,
-        gfc_charlen_type, atype * const restrict,
+void s'name`'rtype_qual`_'atype_code` ('rtype` * const restrict,
+        gfc_charlen_type, 'atype` * const restrict,
        const index_type * const restrict,
        GFC_LOGICAL_4 *, gfc_charlen_type);
 
-export_proto(`s'name`'rtype_qual`_'atype_code);
+export_proto(s'name`'rtype_qual`_'atype_code`);
 
 void
-`s'name`'rtype_qual`_'atype_code (rtype * const restrict retarray, 
-       gfc_charlen_type xlen, atype * const restrict array, 
+s'name`'rtype_qual`_'atype_code` ('rtype` * const restrict retarray, 
+       gfc_charlen_type xlen, 'atype` * const restrict array, 
        const index_type * const restrict pdim,
        GFC_LOGICAL_4 *mask, gfc_charlen_type string_len)
 
@@ -393,7 +396,7 @@ void
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
   index_type dspacing[GFC_MAX_DIMENSIONS];
-  rtype_name * restrict dest;
+  'rtype_name` * restrict dest;
   index_type rank;
   index_type n;
   index_type dim;
@@ -401,7 +404,7 @@ void
 
   if (mask == NULL || *mask)
     {
-      name`'rtype_qual`_'atype_code (retarray, xlen, array, pdim, string_len);
+      'name`'rtype_qual`_'atype_code` (retarray, xlen, array, pdim, 
string_len);
       return;
     }
   /* Make dim zero based to avoid confusion.  */

Reply via email to