[PATCH] [caf_shmem] Fix failures when running when compiled with -m32

Jerry D <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
The attached patch from Andre is fairly straight forward.

The problem was found during our complete patch set testing.

Regression tested on x86_64 with -m32.

OK for mainline along with the whole patch set when ready?

Regards,

Jerry

Author: Andre Vehreschild <[email protected]>
Date:   Sat Feb 14 20:20:48 2026 -0800

     Fortran: Fix run time failures when compiled with -m32

             PR fortran/124080

     libgfortran/ChangeLog:

             * caf/shmem/hashmap.c (hash): Use size_t instead of
             uint64.
             (hmiadd): Use size_t instead of ssize_t.
             (scan_inside_lookahead): Use size_t instead of
             ssize_t.
             (scan_empty): Likewise.
m32fix.diff (text/x-patch, 1.8 KB)
commit 13d1b63a24ac561f7d3595b5152ea44622ec4c52
Author: Andre Vehreschild <[email protected]>
Date:   Sat Feb 14 20:20:48 2026 -0800

    Fortran: Fix run time failures when compiled with -m32
    
            PR fortran/124080
    
    libgfortran/ChangeLog:
    
            * caf/shmem/hashmap.c (hash): Use size_t instead of
            uint64.
            (hmiadd): Use size_t instead of ssize_t.
            (scan_inside_lookahead): Use size_t instead of
            ssize_t.
            (scan_empty): Likewise.

diff --git a/libgfortran/caf/shmem/hashmap.c b/libgfortran/caf/shmem/hashmap.c
index e17d6dd2dca..1dd39801861 100644
--- a/libgfortran/caf/shmem/hashmap.c
+++ b/libgfortran/caf/shmem/hashmap.c
@@ -45,8 +45,8 @@ typedef struct
 
 /* 64 bit to 64 bit hash function.  */
 
-static inline uint64_t
-hash (uint64_t key)
+static inline size_t
+hash (size_t key)
 {
   key ^= (key >> 30);
   key *= 0xbf58476d1ce4e5b9ul;
@@ -83,7 +83,7 @@ hmiadd (hashmap *hm, size_t s, ssize_t o)
 
 /* Get the expected offset for entry id.  */
 
-static inline ssize_t
+static inline size_t
 get_expected_offset (hashmap *hm, memid id)
 {
   return hash (id) >> (VOIDP_BITS - hm->s->bitnum);
@@ -115,7 +115,7 @@ hashmap_init_supervisor (hashmap *hm, hashmap_shared *hs, allocator *a)
    the expected position and the maximum lookahead.  */
 
 static ssize_t
-scan_inside_lookahead (hashmap *hm, ssize_t expected_off, memid id)
+scan_inside_lookahead (hashmap *hm, size_t expected_off, memid id)
 {
   ssize_t lookahead;
   hashmap_entry *data;
@@ -135,7 +135,7 @@ scan_inside_lookahead (hashmap *hm, ssize_t expected_off, memid id)
    to the expected position.  */
 
 static ssize_t
-scan_empty (hashmap *hm, ssize_t expected_off)
+scan_empty (hashmap *hm, size_t expected_off)
 {
   hashmap_entry *data;
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.