summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm/wasm-validator.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 5ca6b2783..aaf5a7fd5 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -262,16 +262,16 @@ void WasmValidator::visitAtomicCmpxchg(AtomicCmpxchg* curr) {
shouldBeIntOrUnreachable(curr->expected->type, curr, "Atomic operations are only valid on int types");
}
void WasmValidator::validateMemBytes(uint8_t bytes, WasmType type, Expression* curr) {
- if (type == unreachable) {
- return; // nothing to validate in this case
- }
switch (bytes) {
case 1:
case 2:
- case 4:
- break;
+ case 4: break;
case 8: {
- shouldBeEqual(getWasmTypeSize(type), 8U, curr, "8-byte mem operations are only allowed with 8-byte wasm types");
+ // if we have a concrete type for the load, then we know the size of the mem operation and
+ // can validate it
+ if (type != unreachable) {
+ shouldBeEqual(getWasmTypeSize(type), 8U, curr, "8-byte mem operations are only allowed with 8-byte wasm types");
+ }
break;
}
default: fail("Memory operations must be 1,2,4, or 8 bytes", curr);