<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>266649</bug_id>
          
          <creation_ts>2023-12-19 11:15:14 -0800</creation_ts>
          <short_desc>Failure memory order cannot be release or acq_rel.</short_desc>
          <delta_ts>2023-12-22 13:05:13 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Platform</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Seija K.">gfunni234</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>mark.lam</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2000789</commentid>
    <comment_count>0</comment_count>
    <who name="Seija K.">gfunni234</who>
    <bug_when>2023-12-19 11:15:14 -0800</bug_when>
    <thetext>It is undefined behavior and clang now enforces this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2001089</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2023-12-20 09:59:46 -0800</bug_when>
    <thetext>https://github.com/WebKit/WebKit/pull/22049</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2001095</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2023-12-20 10:14:46 -0800</bug_when>
    <thetext>(In reply to Seija K. from comment #0)
&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2001592</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-12-22 08:29:21 -0800</bug_when>
    <thetext>&lt;rdar://problem/120047049&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2001593</commentid>
    <comment_count>4</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2023-12-22 08:32:03 -0800</bug_when>
    <thetext>(In reply to Mark Lam from comment #2)
&gt; Can you please point us to the C++ spec where it says that using release or
&gt; 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&apos;s a table that says for `compare_exchange_strong`&apos;s &quot;load operation&quot; 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
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2001638</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-12-22 13:05:12 -0800</bug_when>
    <thetext>Committed 272461@main (d2ba4a07e209): &lt;https://commits.webkit.org/272461@main&gt;

Reviewed commits have been landed. Closing PR #22049 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>