| Issue |
177701
|
| Summary |
`-latomic` required on x86 (32-bit) for `std::atomic<double>` with `-std >= c++20`
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
jpalus
|
I'm not entirely sure whether it's an actual bug or expected behavior however it is somewhat odd results differs depending on C++ version used for compilation:
With C++11 or C++17 it works fine:
```
$ printf '#include <atomic>\nint main() { std::atomic<double> a; a = 1; }' | clang++ -march=i686 -std=c++17 -x c++ - -o /dev/null
$
```
while with C++20 or C++23 it fails on missing symbol (appears to require `-latomic`):
```
$ printf '#include <atomic>\nint main() { std::atomic<double> a; a = 1; }' | clang++ -march=i686 -std=c++20 -x c++ - -o /dev/null
/usr/bin/ld: /tmp/--c512c3.o: in function `std::__atomic_float<double>::store(double, std::memory_order)':
-:(.text._ZNSt14__atomic_floatIdE5storeEdSt12memory_order[_ZNSt14__atomic_floatIdE5storeEdSt12memory_order]+0x94): undefined reference to `__atomic_store'
/usr/bin/ld: -:(.text._ZNSt14__atomic_floatIdE5storeEdSt12memory_order[_ZNSt14__atomic_floatIdE5storeEdSt12memory_order]+0xc9): undefined reference to `__atomic_store'
/usr/bin/ld: -:(.text._ZNSt14__atomic_floatIdE5storeEdSt12memory_order[_ZNSt14__atomic_floatIdE5storeEdSt12memory_order]+0xfe): undefined reference to `__atomic_store'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```
LLVM 20.1.8
x86 (32-bit)
Linux
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs