summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-10-05 10:50:48 -0700
committerGitHub <noreply@github.com>2018-10-05 10:50:48 -0700
commite7756828726ec87afeb923a94d785f594de96aa7 (patch)
tree46806b5665825db9aca89919cd798ce68a4382a2 /src/wasm/wasm-validator.cpp
parentf7db9e9760ea39d77433766e299f29a3084c948c (diff)
downloadbinaryen-e7756828726ec87afeb923a94d785f594de96aa7.tar.gz
binaryen-e7756828726ec87afeb923a94d785f594de96aa7.tar.bz2
binaryen-e7756828726ec87afeb923a94d785f594de96aa7.zip
No atomic float operations (#1693)
SafeHeap was emitting them, but it looks like they are invalid according to the wasm-threads spec. Fixes kripken/emscripten#7208
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r--src/wasm/wasm-validator.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 36069f8db..4d88b9d1f 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -502,7 +502,10 @@ void FunctionValidator::visitLoad(Load* curr) {
validateMemBytes(curr->bytes, curr->type, curr);
validateAlignment(curr->align, curr->type, curr->bytes, curr->isAtomic, curr);
shouldBeEqualOrFirstIsUnreachable(curr->ptr->type, i32, curr, "load pointer type must be i32");
- if (curr->isAtomic) shouldBeFalse(curr->signed_, curr, "atomic loads must be unsigned");
+ if (curr->isAtomic) {
+ shouldBeFalse(curr->signed_, curr, "atomic loads must be unsigned");
+ shouldBeTrue(isIntegerType(curr->type), curr, "atomic loads must be of integers");
+ }
}
void FunctionValidator::visitStore(Store* curr) {
@@ -513,6 +516,9 @@ void FunctionValidator::visitStore(Store* curr) {
shouldBeEqualOrFirstIsUnreachable(curr->ptr->type, i32, curr, "store pointer type must be i32");
shouldBeUnequal(curr->value->type, none, curr, "store value type must not be none");
shouldBeEqualOrFirstIsUnreachable(curr->value->type, curr->valueType, curr, "store value type must match");
+ if (curr->isAtomic) {
+ shouldBeTrue(isIntegerType(curr->valueType), curr, "atomic stores must be of integers");
+ }
}
void FunctionValidator::visitAtomicRMW(AtomicRMW* curr) {