Skip to content

Commit

Permalink
pythongh-112779: Check 1-byte atomics in configure
Browse files Browse the repository at this point in the history
  • Loading branch information
colesbury committed Dec 6, 2023
1 parent 16448ca commit 1807f54
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
15 changes: 11 additions & 4 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7052,12 +7052,19 @@ typedef intptr_t Py_ssize_t;
int main()
{
uint64_t byte;
_Py_atomic_store_uint64(&byte, 2);
if (_Py_atomic_or_uint64(&byte, 8) != 2) {
uint64_t value;
_Py_atomic_store_uint64(&value, 2);
if (_Py_atomic_or_uint64(&value, 8) != 2) {
return 1; // error
}
if (_Py_atomic_load_uint64(&byte) != 10) {
if (_Py_atomic_load_uint64(&value) != 10) {
return 1; // error
}
uint8_t byte = 0xb8;
if (_Py_atomic_or_uint8(&byte, 0x2d) != 0xb8) {
return 1; // error
}
if (_Py_atomic_load_uint8(&byte) != 0xbd) {
return 1; // error
}
return 0; // all good
Expand Down

0 comments on commit 1807f54

Please sign in to comment.