Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm-encoder: Wrong encoding of i64x2.le_s instruction #812

Closed
adambratschikaye opened this issue Nov 9, 2022 · 1 comment
Closed

wasm-encoder: Wrong encoding of i64x2.le_s instruction #812

adambratschikaye opened this issue Nov 9, 2022 · 1 comment

Comments

@adambratschikaye
Copy link
Contributor

The following example encodes the i64x2.le_s instruction using wasm-encoder and then reads it back using wasmparser, but doesn't round trip:

use wasm_encoder::{Encode, Function, Instruction};
use wasmparser::FunctionBody;

fn main() {
    let mut function = Function::new(vec![]);
    function.instruction(&Instruction::I64x2LeS);

    let mut buf = vec![];
    function.encode(&mut buf);
    println!("{:x?}", buf);

    // Skip leading byte containing the function body length.
    let body = FunctionBody::new(0, &buf[1..]);
    let mut reader = body.get_operators_reader().unwrap();
    println!("{:?}", reader.read().unwrap());
}

output:

[4, 0, fd, dd, 1]
I64x2ExtMulHighI32x4S
@alexcrichton
Copy link
Member

Fixed in #811

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

No branches or pull requests

2 participants