Bug 266649
Summary: | Failure memory order cannot be release or acq_rel. | ||
---|---|---|---|
Product: | WebKit | Reporter: | Seija K. <gfunni234> |
Component: | Platform | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | mark.lam, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Seija K.
It is undefined behavior and clang now enforces this.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
https://github.com/WebKit/WebKit/pull/22049
Mark Lam
(In reply to Seija K. from comment #0)
> It is undefined behavior and clang now enforces this.
Can you please point us to the C++ spec where it says that using release or acq_rel for the failure memory order is undefined behavior? Thanks.
Radar WebKit Bug Importer
<rdar://problem/120047049>
Mark Lam
(In reply to Mark Lam from comment #2)
> Can you please point us to the C++ spec where it says that using release or
> acq_rel for the failure memory order is undefined behavior? Thanks.
From https://en.cppreference.com/w/cpp/atomic/atomic/compare_exchange:
```
If failure is stronger than success or(until C++17) is one of std::memory_order_release and std::memory_order_acq_rel, the behavior is undefined.
```
Also, from that link, there's a table that says for `compare_exchange_strong`'s "load operation" in the failure mode, to use:
```
* std::memory_order_acquire if order is std::memory_order_acq_rel
* std::memory_order_relaxed if order is std::memory_order_release
* otherwise order
```
EWS
Committed 272461@main (d2ba4a07e209): <https://commits.webkit.org/272461@main>
Reviewed commits have been landed. Closing PR #22049 and removing active labels.