https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128618
--- Comment #8 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:a170e2d13746b5c2449408dc7a6a1ede98f5cab5 commit r17-6579-ga170e2d13746b5c2449408dc7a6a1ede98f5cab5 Author: Jerry DeLisle <[email protected]> Date: Wed Nov 11 09:07:20 2026 -0800 libgfortran: [PR128618] Avoid libatomic calls for the unit file id The PR118935 fix accesses the 64-bit file_dev and file_ino fields of gfc_unit with __atomic builtins whenever HAVE_ATOMIC_FETCH_ADD is defined, but that configure check tests only an int. On 32-bit targets without inline 64-bit atomics the accesses become calls into libatomic, which libgfortran does not link. r17-6152 made the check test a 64-bit type instead, but on those targets that also turns off the atomics for the unit waiting count and stream pointer, and the waiting count is then incremented under a read lock without them. Revert r17-6152 and use atomic accesses for the file id only where 64-bit atomics are lock-free. Assisted-by: Claude Opus 5.5 PR libfortran/128618 libgfortran/ChangeLog: * acinclude.m4 (LIBGFOR_CHECK_ATOMIC_FETCH_ADD): Revert r17-6152; test int again. Note that 64-bit atomics are not covered. * configure: Regenerate. * io/io.h (GFC_ATOMIC_FILE_ID): Define if 64-bit atomics are lock-free. (set_unit_file_id, unit_file_id_matches): Use it instead of HAVE_ATOMIC_FETCH_ADD.
