Skip to content

frem float miscompilation #5399

@pepyakin

Description

@pepyakin

Source: rust-lang/rust#42629

Minimized example:

define float @foo(float, float) unnamed_addr #2 {
start:
  %2 = frem float %0, %1
  ret float %2
}
emcc -s BINARYEN=1 -s "EXPORTED_FUNCTIONS=['_foo']" example.ll

Gives following output (stripped):

[wasm-validator error in function $_foo] 3 != 4: call param types must match[wasm-validator error in function $_foo] 3 != 4: call param types must match, on
[f64] (call $f64-rem
 [f32] (get_local $0)
 [f32] (get_local $1)
), on
[f64] (call $f64-rem
 [f32] (get_local $0)
 [f32] (get_local $1)
)
(on argument
(on argument 0)
0)
[wasm-validator error in function $_foo] [wasm-validator error in function $_foo] 3 != 4: 3 != 4: call param types must match, on
[f64call param types must match, on
[f64] (call $] (call $f64-rem
 [f64-rem
 [f32] (get_local f32] (get_local $0)
$0)
 [f32]  [f32] (get_local $1(get_local $1)
)
)
)
(on argument 1)

emcc version:

emcc (Emscripten gcc/clang-like replacement) 1.37.15 (commit f6d143855e660647e8f09795e7d2dbdd5b64245c)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions