[libcxx-commits] [libcxx] [libcxx][test] Prevent compiler optimising out uses of 64-bit atomics (PR #172517)
David Spickett via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 18 02:19:15 PST 2025
DavidSpickett wrote:
gcc build failing with:
```
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/wait.pass.cpp: In instantiation of ‘void test_impl() [with T = float; MaybeVolatile = std::__1::add_volatile_t]’:
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/wait.pass.cpp:113:38: required from ‘void test() [with T = float]’
# | 113 | test_impl<T, std::add_volatile_t>();
# | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/wait.pass.cpp:118:14: required from here
# | 118 | test<float>();
# | | ~~~~~~~~~~~^~
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/wait.pass.cpp:41:5: error: implicit dereference will not access object of type ‘volatile std::__1::atomic<float>’ in statement [-Werror]
# | 41 | DoNotOptimize(a);
# | | ^~~~~~~~~~~~~
```
So I'm not sure this code is reliable across compilers either.
https://github.com/llvm/llvm-project/pull/172517
More information about the libcxx-commits
mailing list