https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127751
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jerry DeLisle <[email protected]>: https://gcc.gnu.org/g:da8eaee295071ab2c24c837e0323a10463174a8e commit r17-5794-gda8eaee295071ab2c24c837e0323a10463174a8e Author: Jerry DeLisle <[email protected]> Date: Thu Oct 29 19:30:05 2026 -0400 libgfortran: [PR127751] caf_shmem: report a full table of coarray ids When ALLOCATE of a coarray needed a larger table of coarray ids and the shared memory pool could not hold it, the image error terminated while holding the allocator lock, so the other images hung. The table is now left unchanged and the failure is reported through STAT= and ERRMSG=. Old tables were also freed with their number of entries instead of their size in bytes. A failed ALLOCATE of a component of a coarray freed the token of the component, so retrying the ALLOCATE freed it twice. The token is now kept. Assisted-by: Claude Opus 5.5 PR libfortran/127751 libgfortran/ChangeLog: * caf/shmem.c (_gfortran_caf_register): Keep the token of a component when its allocation fails. * caf/shmem/alloc.c (get_memory_by_id_internal): Free the memory and return NULL when the id cannot be entered into the hashmap. * caf/shmem/hashmap.c (enlarge_hashmap_mem): Return false, leaving the hashmap unchanged, when the shared memory is exhausted. Free the old table with its size in bytes. (resize_hm): Return false and restore the old table on failure. Free the old table with its size in bytes. (hashmap_set): Return false when the hashmap cannot be enlarged. * caf/shmem/hashmap.h (hashmap_set): Return bool. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/alloc_pool_exhausted_3.f90: New test.
