GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libgfortran

libgfortran: Ensure HAVE_ATOMIC_FETCH_ADD reflects 64-bit integer operations

libgfortran's atomic fetch-and-add check now correctly targets 64-bit integers, fixing issues on 32-bit systems.

A recent change in GCC’s atomic operations handling broke libgfortran on 32-bit systems by incorrectly assuming __atomic_fetch_add worked on uint64_t. This commit corrects the LIBGFOR_CHECK_ATOMIC_FETCH_ADD configure test to accurately check for 64-bit integer support. This resolves issues for 32-bit systems that lack the necessary 64-bit atomic operations or libatomic support.

In Details

The configure macro LIBGFOR_CHECK_ATOMIC_FETCH_ADD in acinclude.m4 has been updated to correctly probe for the availability of __atomic_fetch_add on 64-bit integer types, specifically using __INT64_TYPE__. Previously, it incorrectly checked against int, leading to false positives on 32-bit platforms where 64-bit atomic operations are not natively supported or when libatomic is not available. This fix ensures that HAVE_ATOMIC_FETCH_ADD accurately reflects the capability to perform atomic fetch-and-add operations on 64-bit integers, preventing build failures and runtime issues in…

For Context
__atomic_fetch_add
A GCC built-in function that atomically adds a value to a variable and returns the original value. It's a fundamental operation for concurrent programming.
libatomic
A GCC runtime library that provides atomic built-in functions for platforms that do not support them natively in hardware.
HAVE_ATOMIC_FETCH_ADD
A configuration macro symbol indicating whether the system supports atomic fetch-and-add operations, typically defined during the configure process.
__INT64_TYPE__
A GCC predefined type macro that expands to the underlying type used for 64-bit integers on the target system (e.g., long long).
Filed Under: libgfortranatomic operationsconfigure