https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124080

            Bug ID: 124080
           Summary: [caf_shmem] Failures when running when compiled with
                    -m32
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jvdelisle at gcc dot gnu.org
  Target Milestone: ---

This problem manifests with runtime failures when using the new coarray shared
memory library provided in the patch set here:

https://gcc.gnu.org/pipermail/fortran/2026-February/063451.html

When compiling a program with -m32 -fcoarray=lib -lcaf_shmem the execution
fails.  Problem identified by Iain Sandoe during testing on Darwin.

This is fixed by the following patch:

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;


Provided by Andre Vehreschild <[email protected]>

Reply via email to