sunfishcode opened PR #10670 from sunfishcode:sunfishcode/trunc-libcall to bytecodealliance:main:
When
!clif_instruction_traps_enabled(), the float-to-int conversion would sometimes emit a Cranelifttruncinstruction directly, without checkinghas_round(), which led to Cranelift emitting a libcall. Fix it by calling thetrunc_f32andtrunc_f64routines which do checkhas_round().This fixes a fuzzbug from #10657.
<!--
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
-->
sunfishcode requested dicej for a review on PR #10670.
sunfishcode requested wasmtime-core-reviewers for a review on PR #10670.
sunfishcode commented on PR #10670:
What's a good place to add a testcase for this? It needs a Wasm input, a custom target configuration, and it needs to check the generated Cranelift code or machine code.
cfallin commented on PR #10670:
What's a good place to add a testcase for this?
We have the disas tests now; a good example with specific target settings might be this one (for the x86-64 BMI2 extensions). We have the env-var-based "blessing" infra here to autogenerate the expectation, too (
WASMTIME_TEST_BLESS=1).
cfallin edited a comment on PR #10670:
What's a good place to add a testcase for this?
We have the disas tests now; a good example with specific target settings might be this one (for the x86-64 BMI2 extensions). We have the env-var-based "blessing" infra here to autogenerate the expectation, too (
WASMTIME_TEST_BLESS=1 cargo test --test disas).
cfallin submitted PR review.
sunfishcode updated PR #10670.
sunfishcode merged PR #10670.
Last updated: Dec 06 2025 at 07:03 UTC