Skip to content

Fix float argument types in wasm-interp --run-export - #2811

Merged
sbc100 merged 1 commit into
WebAssembly:mainfrom
XX-Q:codex/fix-float-run-export-2664
Aug 8, 2026
Merged

Fix float argument types in wasm-interp --run-export#2811
sbc100 merged 1 commit into
WebAssembly:mainfrom
XX-Q:codex/fix-float-run-export-2664

Conversation

@XX-Q

@XX-Q XX-Q commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #2664.

ParseFloat and ParseDouble return the IEEE-754 bit pattern in an unsigned integer. ParseWasmValue passed those integers directly to Value::Set, so debug builds tagged f32/f64 command-line arguments as i32/i64. The interpreter then failed its value-stack type check as soon as the exported function consumed an argument.

Bitcast the parsed bits to the corresponding floating-point type before storing them. This preserves both the value and the interpreter type tag.

A CLI regression test covers both f32 and f64 arguments.

Validation:

@sbc100 sbc100 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, I'm surprised we didn't have any coverage for this already.

Thanks!

@sbc100
sbc100 merged commit 76800b2 into WebAssembly:main Aug 8, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assertion `t == type || type == ValueType::Any' failed at wasm-interp

2 participants