Skip to content

Truncating slightly less than INT32_MIN? #1224

@kripken

Description

@kripken
(module
 (func (export "trunc")
  (drop
   (i32.trunc_f64_s
    (f64.const -2147483648.1)
   )
  )
 )
)
(assert_trap (invoke "trunc") "integer overflow")

This behaves differently in different VMs: The spec interpreter, JavaScriptCore, wabt and binaryen trap (that is, the testcase passes as it throws an error when doing the truncation), while V8 and SpiderMonkey do not trap.

To run it: d8 aa.js -- aa.wasm etc., or run the above wast file in something that can run spec testcases.

test.zip

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