v8/test/mjsunit/regress/regress-crbug-976934.js
Michael Starzinger f03430fe4c [asm.js] Fix undefined cast from double to float.
This fixes undefined behavior in the implicit cast from double to float
when a double literal is passed through {fround} while declaring a local
variable.

R=jkummerow@chromium.org
TEST=mjsunit/regress/regress-crbug-976934
BUG=chromium:976934

Change-Id: I0efa2bf3f89d32c445f0b9bf719880d17fe9743c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1683999
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62469}
2019-07-01 14:27:05 +00:00

23 lines
495 B
JavaScript

// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
function Module(stdlib, imports, heap) {
"use asm";
var fround = stdlib.Math.fround;
function f() {
var x = fround(-1.7976931348623157e+308);
return fround(x);
}
return { f: f };
}
var m = Module(this);
assertEquals(-Infinity, m.f());
assertTrue(%IsAsmWasmCode(Module));