-
Notifications
You must be signed in to change notification settings - Fork 14k
[libc++] Fix std::atomic::wait
ulock wait UL_COMPARE_AND_WAIT64
#92783
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
Changes from all commits
c92abdc
21d3d4c
7a4e0a4
e06e1d5
f3913f0
08f53f4
f903ab9
184abaf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,32 @@ | ||||||||||
//===----------------------------------------------------------------------===// | ||||||||||
// | ||||||||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||||||||
// See https://llvm.org/LICENSE.txt for license information. | ||||||||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||||||||
// | ||||||||||
//===----------------------------------------------------------------------===// | ||||||||||
// UNSUPPORTED: c++03, c++11, c++14, c++17 | ||||||||||
// UNSUPPORTED: no-threads | ||||||||||
// This bug was first fixed in LLVM 19 | ||||||||||
// UNSUPPORTED: using-built-library-before-llvm-19 | ||||||||||
// XFAIL: availability-synchronization_library-missing | ||||||||||
|
||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm assuming that implies "Darwin"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://buildkite.com/llvm-project/libcxx-ci/builds/35617#018fc382-8cf3-45dc-a8c8-c3c9d9ccd245 Unfortunately we have "unexpected passes" because of this line. It seems that the CI "Apple system" does have this feature
and from what I can see, it is linking against the just built libc++ which has the fix in it
|
||||||||||
#include <atomic> | ||||||||||
#include <cassert> | ||||||||||
|
||||||||||
void test_85107() { | ||||||||||
if constexpr (sizeof(std::__cxx_contention_t) == 8 && sizeof(long) > 4) { | ||||||||||
// https://github.com/llvm/llvm-project/issues/85107 | ||||||||||
// [libc++] atomic_wait uses UL_COMPARE_AND_WAIT when it should use UL_COMPARE_AND_WAIT64 on Darwin | ||||||||||
constexpr std::__cxx_contention_t old_val = 0; | ||||||||||
constexpr std::__cxx_contention_t new_val = old_val + (1ll << 32); | ||||||||||
std::__cxx_atomic_contention_t ct(new_val); | ||||||||||
std::__libcpp_atomic_wait(&ct, old_val); // this will hang forever if the bug is present | ||||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
int main(int, char**) { | ||||||||||
test_85107(); | ||||||||||
|
||||||||||
return 0; | ||||||||||
} |
Uh oh!
There was an error while loading. Please reload this page.