Skip to content

Bug: tests involving f64 argument or return types may fail #34

@abelstuker

Description

@abelstuker

The return values of Wasm functions with f64 as their return type are incorrectly parsed. Additionally, f64 arguments to Wasm functions are also incorrectly conversed.

Consider this Wasm module:

(module
  (func (export "get-5-i32") (result i32) (i32.const 5))
  (func (export "get-5-i64") (result i64) (i64.const 5))
  (func (export "get-5-f32") (result f32) (f32.const 5))
  (func (export "get-5-f64") (result f64) (f64.const 5))

  (func (export "check-eq-5-i32") (param i32) (result i32) (i32.eq (local.get 0) (i32.const 5)))
  (func (export "check-eq-5-i64") (param i64) (result i32) (i64.eq (local.get 0) (i64.const 5)))
  (func (export "check-eq-5-f32") (param f32) (result i32) (f32.eq (local.get 0) (f32.const 5)))
  (func (export "check-eq-5-f64") (param f64) (result i32) (f64.eq (local.get 0) (f64.const 5)))
)

When testing these exports, we expect all the getter functions to return the value 5 and all the check functions, when provided with the argument 5, to return 1.

However, this is not what we observe:

      ✔ Get 5 as i32
      ✔ Get 5 as i64
      ✔ Get 5 as f32
      ✖ Get 5 as f64
        Failure: Expected 5 got 0
      ✔ Check if i32 argument is equal to 5
      ✔ Check if i64 argument is equal to 5
      ✔ Check if f32 argument is equal to 5
      ✖ Check if f64 argument is equal to 5
        Failure: Expected 1 got 0

The f64 value getter returns 0 instead of 5 as expected. The f64 argument equality checker fails instead of succeeding as expected.
The tests covering Wasm functions that involve f64 argument or return types incorrectly (may) fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions