summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
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) {