libgfortran: Store aligned offset in shared_memory_get_master
Fix alignment issue in shared memory metadata to prevent crashes on specific architectures.
The libgfortran library incorrectly stored an unaligned memory offset in shared memory metadata. This led to assertion failures on targets like hppa-linux-gnu where alignment requirements exceed the metadata structure size. The fix ensures the correctly aligned offset is stored, resolving the crash.
In Details
The shared_memory_get_master function in libgfortran's CAF implementation was writing an unaligned used value to mem->glbl.meta->master instead of the aligned offset returned by shared_memory_get_mem_with_alignment. This caused a misalignment on targets with stricter alignment needs (e.g., hppa-linux-gnu requiring 16-byte alignment for supervisor when global_shared_memory_meta is only 8 bytes), leading to supervisor writes at the wrong offset and subsequent assertion failures in ensure_shmem_initialization.