saulecabrera opened PR #12994 from saulecabrera:winch-properly-uextend-cmpxchg to bytecodealliance:main:
Accoding to the spec, the result of a compare-and-swap operation must be zero extended according to the result type. Prior to this commit the implementation was skipping the 32 -> 64 bit case.
When the swap happens, the value in
raxremains untouched, however, it's possible that the higher bits are undefined, in which case the zero extension is needed to ensure that the right value is returned.This bug is only reproducible for values in which the lower bits match the expected value, like in the example included in this commit.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
saulecabrera requested uweigand for a review on PR #12994.
saulecabrera requested wasmtime-compiler-reviewers for a review on PR #12994.
saulecabrera requested fitzgen for a review on PR #12994.
saulecabrera requested wasmtime-core-reviewers for a review on PR #12994.
github-actions[bot] added the label winch on PR #12994.
github-actions[bot] commented on PR #12994:
Subscribe to Label Action
cc @saulecabrera
<details>
This issue or pull request has been labeled: "winch"Thus the following users have been cc'd because of the following labels:
- saulecabrera: winch
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
fitzgen submitted PR review:
Thanks!
fitzgen added PR #12994 winch: Properly zero extend the CAS result to the merge queue.
alexcrichton removed PR #12994 winch: Properly zero extend the CAS result from the merge queue.
alexcrichton commented on PR #12994:
Manually removing from queue due to failure at https://github.com/bytecodealliance/wasmtime/actions/runs/24209086212/job/70672712892
saulecabrera updated PR #12994.
saulecabrera commented on PR #12994:
Ok, I've fixed the issues. I'll re-add to the queue.
saulecabrera has enabled auto merge for PR #12994.
saulecabrera added PR #12994 winch: Properly zero extend the CAS result to the merge queue.
saulecabrera removed PR #12994 winch: Properly zero extend the CAS result from the merge queue.
saulecabrera merged PR #12994.
Last updated: Apr 12 2026 at 23:10 UTC