GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libstdc++

libstdc++: Fix atomic check on Windows for MinGW builds.

Fixes configure check for atomics on native MinGW-w64 builds in libstdc++.

This commit resolves an issue where the configure script incorrectly detected a lack of atomic builtins for native MinGW-w64 builds, leading to the use of non-inline atomics. The fix involves copying the atomic_word.h header to the current working directory during the configure process, allowing it to be included without absolute paths. This ensures the correct ABI and consistent behavior with MinGW cross-compilers.

In Details

The GLIBCXX_ENABLE_ATOMIC_BUILTINS macro in acinclude.m4 performs a configure-time check for atomic builtins. This commit addresses a failure of this check on native mingw-w64 builds due to incorrect include paths, which led to an unintended ABI change. The fix copies the atomic_word.h header to enable the check to pass.

For Context

Atomic operations are fundamental for thread-safe programming, allowing multiple threads to access and modify shared data without race conditions. The C++ standard library relies on compiler builtins for atomic operations when available. This commit fixes a configuration issue on Windows (MinGW) that prevented the C++ library from correctly detecting the availability of these builtins, potentially leading to performance problems or incorrect behavior in multithreaded programs.

Filed Under: libstdc++mingwwindowsatomicsconfigure