https://gcc.gnu.org/g:290f35d0be60ff1df99b233447df1741418cd59f

commit 290f35d0be60ff1df99b233447df1741418cd59f
Author: Mikael Morin <[email protected]>
Date:   Tue Sep 9 17:02:59 2025 +0200

    Correction cshift0.m4

Diff:
---
 libgfortran/m4/cshift0.m4 | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/libgfortran/m4/cshift0.m4 b/libgfortran/m4/cshift0.m4
index d5427a161dfa..650703cf1253 100644
--- a/libgfortran/m4/cshift0.m4
+++ b/libgfortran/m4/cshift0.m4
@@ -112,10 +112,10 @@ cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, 
ptrdiff_t shift,
         bn = cshift(a,sh*n1*n2,1)
 
         we can used a more blocked algorithm for dim>1.  */
-      sstride[0] = 1;
-      rstride[0] = 1;
-      roffset = 1;
-      soffset = 1;
+      sstride[0] = sizeof ('rtype_name`);
+      rstride[0] = sizeof ('rtype_name`);
+      roffset = sizeof ('rtype_name`);
+      soffset = sizeof ('rtype_name`);
       len = GFC_DESCRIPTOR_STRIDE(array, which)
        * GFC_DESCRIPTOR_EXTENT(array, which);      
       shift *= GFC_DESCRIPTOR_STRIDE(array, which);
@@ -137,10 +137,10 @@ cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, 
ptrdiff_t shift,
            {
              roffset = GFC_DESCRIPTOR_STRIDE_BYTES(ret,dim);
              if (roffset == 0)
-               roffset = GFC_DESCRIPTOR_SIZE(ret);
-             soffset = GFC_DESCRIPTOR_STRIDE(array,dim);
+               roffset = sizeof ('rtype_name`);
+             soffset = GFC_DESCRIPTOR_STRIDE_BYTES(array,dim);
              if (soffset == 0)
-               soffset = GFC_DESCRIPTOR_SIZE(array);
+               soffset = sizeof ('rtype_name`);
              len = GFC_DESCRIPTOR_EXTENT(array,dim);
            }
          else
@@ -153,9 +153,9 @@ cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, 
ptrdiff_t shift,
            }
        }
       if (sstride[0] == 0)
-       sstride[0] = GFC_DESCRIPTOR_SIZE(array);
+       sstride[0] = sizeof ('rtype_name`);
       if (rstride[0] == 0)
-       rstride[0] = GFC_DESCRIPTOR_SIZE(ret);
+       rstride[0] = sizeof ('rtype_name`);
 
       dim = GFC_DESCRIPTOR_RANK (array);
     }
@@ -179,7 +179,7 @@ cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, 
ptrdiff_t shift,
 
       /* If elements are contiguous, perform the operation
         in two block moves.  */
-      if (soffset == 1 && roffset == 1)
+      if (soffset == sizeof ('rtype_name`) && roffset == sizeof ('rtype_name`))
        {
          size_t len1 = shift * sizeof ('rtype_name`);
          size_t len2 = (len - shift) * sizeof ('rtype_name`);
@@ -191,7 +191,7 @@ cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, 
ptrdiff_t shift,
          /* Otherwise, we will have to perform the copy one element at
             a time.  */
          'rtype_name` *dest = rptr;
-         const 'rtype_name` *src = &sptr[shift * soffset];
+         const 'rtype_name` *src = (const 'rtype_name` *) (((char*)sptr) + 
shift * soffset);
 
          for (n = 0; n < len - shift; n++)
            {

Reply via email to