-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std::atomic<long double>::compare_exchange_weak
does not update expected
on failure
#47978
Comments
expected
on failurestd::atomic<long double>::compare_exchange_weak
does not update expected
on failure
@llvm/issue-subscribers-clang-codegen Author: None (llvmbot)
| | |
| --- | --- |
| Bugzilla Link | [48634](https://llvm.org/bz48634) |
| Version | 11.0 |
| OS | Linux |
| Attachments | [Program reproducing the bug.](https://user-images.githubusercontent.com/60944935/143761585-ccbc075a-2193-43fd-90a8-039eb63b5067.gz) |
| Reporter | LLVM Bugzilla Contributor |
| CC | @zygoloid |
Extended DescriptionThis program does not behave as intended: #include <atomic>
#include <iostream>
int main() {
std::atomic<long double> x;
x.store(1.0);
long double tmp = 2.0;
bool worked = x.compare_exchange_weak(tmp, 3.0);
std::cout << "worked " << worked << " set tmp to " << tmp << std::endl;
std::atomic<double> x2;
x2.store(1.0);
double tmp2 = 2.0;
worked = x2.compare_exchange_weak(tmp2, 3.0);
std::cout << "worked " << worked << " set tmp to " << tmp2 << std::endl;
return 0;
} I compile with
The output is:
My version of clang++-12 is:
The same problem occurs with clang++11 and other optimization levels. The problem is that
does not update Here are the libraries my program is linked against:
The problem seems to be that the atomic headers lead to the fact that in
is called for the 16 byte case. Unfortunately, I cannot easily find the |
Extended Description
This program does not behave as intended:
I compile with
The output is:
My version of clang++-12 is:
The same problem occurs with clang++11 and other optimization levels.
The problem is that
does not update
expected
as specified when the expected value is notfound.
Here are the libraries my program is linked against:
The problem seems to be that the atomic headers lead to the fact that in
the end the compiler intrinsic
is called for the 16 byte case. Unfortunately, I cannot easily find the
source code for this. In any case this function seems to misbehave
for the 16 byte case. I have traced the assembler code and this shows
the wrong behaviour.
The text was updated successfully, but these errors were encountered: