[gcc r17-3255] fortran: Fix element size in CO_BROADCAST implementation [PR126799]

Mikael Morin via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:26ba7ae2c5dafa759314faa5ed6dfa3b3a159368

commit r17-3255-g26ba7ae2c5dafa759314faa5ed6dfa3b3a159368
Author: Mikael Morin <[email protected]>
Date:   Thu Aug 13 11:03:52 2026 +0200

    fortran: Fix element size in CO_BROADCAST implementation [PR126799]
    
    Similarly to the previous element size fix touching the shared memory
    implementation of collective subroutines, use the element length field
    instead of the span field of the input descriptor as element size in the
    CO_BROADCAST shared memory implementation.  Contrary to the collective
    subroutine case, using the span could only cause extra memory usage here,
    without any more harm, and there is no testcase with any observable
    behaviour change.
    
            PR fortran/126799
    
    libgfortran/ChangeLog:
    
            * caf/shmem/collective_subroutine.c (collsub_broadcast_array): Use
            the element length field instead of the span field as element size.

Diff:
---
 libgfortran/caf/shmem/collective_subroutine.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libgfortran/caf/shmem/collective_subroutine.c b/libgfortran/caf/shmem/collective_subroutine.c
index fd5d56e88b2a..01389b18b0a5 100644
--- a/libgfortran/caf/shmem/collective_subroutine.c
+++ b/libgfortran/caf/shmem/collective_subroutine.c
@@ -407,9 +407,7 @@ collsub_broadcast_array (gfc_descriptor_t *desc, int source_image)
 	elem_size = strlen (desc->base_addr);
     }
   else
-    elem_size = GFC_DESCRIPTOR_SPAN (desc) != 0
-		  ? ((index_type) GFC_DESCRIPTOR_SPAN (desc))
-		  : ((index_type) GFC_DESCRIPTOR_SIZE (desc));
+    elem_size = (index_type) GFC_DESCRIPTOR_SIZE (desc);
   size_bytes = elem_size * pi.num_elem;
   buffer = get_collsub_buf (size_bytes);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.