Stream: git-wasmtime

Topic: wasmtime / PR #12609 fix(cranelift): correct sign extensi...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 17 2026 at 20:13):

radik878 opened PR #12609 from radik878:fix/sign-extend-bug to bytecodealliance:main:

What was wrong: The sign extension operators (i32.extend8_s, i32.extend16_s, i64.extend8_s, i64.extend16_s, i64.extend32_s) were incorrectly discarding the ireduce result. The code was pushing the ireduce result to the value stack and then immediately popping a different value (the next value on the stack) for the sextend operation.
Changes: Store the ireduce result in a local variable and use it directly in sextend instead of popping from the stack.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 17 2026 at 20:13):

radik878 requested fitzgen for a review on PR #12609.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 17 2026 at 20:13):

radik878 requested wasmtime-compiler-reviewers for a review on PR #12609.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 17 2026 at 20:21):

cfallin commented on PR #12609:

@radik878 I don't think your description is correct.

The existing code pops, reduces, pushes; then pops, sign-extends, and pushes. The intermediate push-then-pop has the effect of carrying through the result of the reduce to the sign-extend. Nothing is discarded, and the "next value on the stack" is not used.

I didn't write this code so I don't know the intent for sure but I can imagine this is meant to express the operator as a composition of the two operations. It's a little odd, but it's not incorrect.

Your description ("fix") implies that you observed an incorrect execution. Did you, and if so can you show the test case here? And can you explain your reasoning a bit more?


Last updated: Feb 24 2026 at 04:36 UTC