https://gcc.gnu.org/g:5f9271eb7e9c66d7a1e4102dfbba3d81d6a320c1

commit 5f9271eb7e9c66d7a1e4102dfbba3d81d6a320c1
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Wed Aug 20 18:19:07 2025 +0200

    Correction reshape_3

Diff:
---
 libgfortran/generated/reshape_c10.c | 8 +++-----
 libgfortran/generated/reshape_c16.c | 8 +++-----
 libgfortran/generated/reshape_c17.c | 8 +++-----
 libgfortran/generated/reshape_c4.c  | 8 +++-----
 libgfortran/generated/reshape_c8.c  | 8 +++-----
 libgfortran/generated/reshape_i16.c | 8 +++-----
 libgfortran/generated/reshape_i4.c  | 8 +++-----
 libgfortran/generated/reshape_i8.c  | 8 +++-----
 libgfortran/generated/reshape_r10.c | 8 +++-----
 libgfortran/generated/reshape_r16.c | 8 +++-----
 libgfortran/generated/reshape_r17.c | 8 +++-----
 libgfortran/generated/reshape_r4.c  | 8 +++-----
 libgfortran/generated/reshape_r8.c  | 8 +++-----
 libgfortran/m4/reshape.m4           | 8 +++-----
 14 files changed, 42 insertions(+), 70 deletions(-)

diff --git a/libgfortran/generated/reshape_c10.c 
b/libgfortran/generated/reshape_c10.c
index 273ceec8cfbe..521446312bcc 100644
--- a/libgfortran/generated/reshape_c10.c
+++ b/libgfortran/generated/reshape_c10.c
@@ -100,7 +100,6 @@ reshape_c10 (gfc_array_c10 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_COMPLEX_10);
       spacing = sizeof(GFC_COMPLEX_10);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_c10 (gfc_array_c10 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_c10 (gfc_array_c10 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_COMPLEX_10);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/generated/reshape_c16.c 
b/libgfortran/generated/reshape_c16.c
index e7170605f6b0..13ab5045aa41 100644
--- a/libgfortran/generated/reshape_c16.c
+++ b/libgfortran/generated/reshape_c16.c
@@ -100,7 +100,6 @@ reshape_c16 (gfc_array_c16 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_COMPLEX_16);
       spacing = sizeof(GFC_COMPLEX_16);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_c16 (gfc_array_c16 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_c16 (gfc_array_c16 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_COMPLEX_16);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/generated/reshape_c17.c 
b/libgfortran/generated/reshape_c17.c
index 8103a75d4592..74eb45c4fb6c 100644
--- a/libgfortran/generated/reshape_c17.c
+++ b/libgfortran/generated/reshape_c17.c
@@ -100,7 +100,6 @@ reshape_c17 (gfc_array_c17 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_COMPLEX_17);
       spacing = sizeof(GFC_COMPLEX_17);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_c17 (gfc_array_c17 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_c17 (gfc_array_c17 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_COMPLEX_17);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/generated/reshape_c4.c 
b/libgfortran/generated/reshape_c4.c
index d78e56b2e277..87d968739228 100644
--- a/libgfortran/generated/reshape_c4.c
+++ b/libgfortran/generated/reshape_c4.c
@@ -100,7 +100,6 @@ reshape_c4 (gfc_array_c4 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_COMPLEX_4);
       spacing = sizeof(GFC_COMPLEX_4);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_c4 (gfc_array_c4 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_c4 (gfc_array_c4 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_COMPLEX_4);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/generated/reshape_c8.c 
b/libgfortran/generated/reshape_c8.c
index 8cfe5b3e0dbb..5201b175443b 100644
--- a/libgfortran/generated/reshape_c8.c
+++ b/libgfortran/generated/reshape_c8.c
@@ -100,7 +100,6 @@ reshape_c8 (gfc_array_c8 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_COMPLEX_8);
       spacing = sizeof(GFC_COMPLEX_8);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_c8 (gfc_array_c8 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_c8 (gfc_array_c8 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_COMPLEX_8);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/generated/reshape_i16.c 
b/libgfortran/generated/reshape_i16.c
index bc5cdb533373..f1d211a4a916 100644
--- a/libgfortran/generated/reshape_i16.c
+++ b/libgfortran/generated/reshape_i16.c
@@ -100,7 +100,6 @@ reshape_16 (gfc_array_i16 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_INTEGER_16);
       spacing = sizeof(GFC_INTEGER_16);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_16 (gfc_array_i16 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_16 (gfc_array_i16 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_INTEGER_16);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/generated/reshape_i4.c 
b/libgfortran/generated/reshape_i4.c
index 241dbf562199..27d4a4a2f994 100644
--- a/libgfortran/generated/reshape_i4.c
+++ b/libgfortran/generated/reshape_i4.c
@@ -100,7 +100,6 @@ reshape_4 (gfc_array_i4 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_INTEGER_4);
       spacing = sizeof(GFC_INTEGER_4);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_4 (gfc_array_i4 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_4 (gfc_array_i4 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_INTEGER_4);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/generated/reshape_i8.c 
b/libgfortran/generated/reshape_i8.c
index f0f4103ad752..068078dd98dd 100644
--- a/libgfortran/generated/reshape_i8.c
+++ b/libgfortran/generated/reshape_i8.c
@@ -100,7 +100,6 @@ reshape_8 (gfc_array_i8 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_INTEGER_8);
       spacing = sizeof(GFC_INTEGER_8);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_8 (gfc_array_i8 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_8 (gfc_array_i8 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_INTEGER_8);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/generated/reshape_r10.c 
b/libgfortran/generated/reshape_r10.c
index 35ea34960f56..a997acd112a0 100644
--- a/libgfortran/generated/reshape_r10.c
+++ b/libgfortran/generated/reshape_r10.c
@@ -100,7 +100,6 @@ reshape_r10 (gfc_array_r10 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_REAL_10);
       spacing = sizeof(GFC_REAL_10);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_r10 (gfc_array_r10 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_r10 (gfc_array_r10 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_REAL_10);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/generated/reshape_r16.c 
b/libgfortran/generated/reshape_r16.c
index 6b1831ae903e..71c9b974a495 100644
--- a/libgfortran/generated/reshape_r16.c
+++ b/libgfortran/generated/reshape_r16.c
@@ -100,7 +100,6 @@ reshape_r16 (gfc_array_r16 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_REAL_16);
       spacing = sizeof(GFC_REAL_16);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_r16 (gfc_array_r16 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_r16 (gfc_array_r16 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_REAL_16);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/generated/reshape_r17.c 
b/libgfortran/generated/reshape_r17.c
index c8b8b9488466..7e5f93f87273 100644
--- a/libgfortran/generated/reshape_r17.c
+++ b/libgfortran/generated/reshape_r17.c
@@ -100,7 +100,6 @@ reshape_r17 (gfc_array_r17 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_REAL_17);
       spacing = sizeof(GFC_REAL_17);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_r17 (gfc_array_r17 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_r17 (gfc_array_r17 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_REAL_17);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/generated/reshape_r4.c 
b/libgfortran/generated/reshape_r4.c
index 76f23bdd22aa..6042034ce416 100644
--- a/libgfortran/generated/reshape_r4.c
+++ b/libgfortran/generated/reshape_r4.c
@@ -100,7 +100,6 @@ reshape_r4 (gfc_array_r4 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_REAL_4);
       spacing = sizeof(GFC_REAL_4);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_r4 (gfc_array_r4 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_r4 (gfc_array_r4 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_REAL_4);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/generated/reshape_r8.c 
b/libgfortran/generated/reshape_r8.c
index 9bcd139344c1..e8812a33e768 100644
--- a/libgfortran/generated/reshape_r8.c
+++ b/libgfortran/generated/reshape_r8.c
@@ -100,7 +100,6 @@ reshape_r8 (gfc_array_r8 * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof (GFC_REAL_8);
       spacing = sizeof(GFC_REAL_8);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -108,15 +107,14 @@ reshape_r8 (gfc_array_r8 * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -161,7 +159,7 @@ reshape_r8 (gfc_array_r8 * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof (GFC_REAL_8);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];
diff --git a/libgfortran/m4/reshape.m4 b/libgfortran/m4/reshape.m4
index 891f5f8596a9..06abaff66860 100644
--- a/libgfortran/m4/reshape.m4
+++ b/libgfortran/m4/reshape.m4
@@ -104,7 +104,6 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
     {
       index_type alloc_size;
 
-      rs = sizeof ('rtype_name`);
       spacing = sizeof('rtype_name`);
       for (index_type n = 0; n < rdim; n++)
        {
@@ -112,15 +111,14 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
 
          GFC_DESCRIPTOR_DIMENSION_SET(ret, n, 0, rex - 1, spacing);
 
-         rs *= rex;
          spacing *= rex;
        }
       ret->offset = 0;
 
-      if (unlikely (rs < 1))
+      if (unlikely (spacing < 1))
         alloc_size = 0;
       else
-        alloc_size = rs;
+        alloc_size = spacing;
 
       ret->base_addr = xmalloc (alloc_size);
       ret->dtype.rank = rdim;
@@ -165,7 +163,7 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
     {
       index_type ret_extent, source_extent;
 
-      rs = sizeof ('rtype_name`);
+      rs = 1;
       for (index_type n = 0; n < rdim; n++)
        {
          rs *= shape_data[n];

Reply via email to