diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-validator.h | 2 | ||||
-rw-r--r-- | src/wasm/wasm-validator.cpp | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/wasm-validator.h b/src/wasm-validator.h index 2ec530476..f83f5209d 100644 --- a/src/wasm-validator.h +++ b/src/wasm-validator.h @@ -217,7 +217,7 @@ public: void validateAlignment(size_t align, WasmType type, Index bytes, bool isAtomic, Expression* curr); - void validateMemBytes(uint8_t bytes, WasmType ty, Expression* curr); + void validateMemBytes(uint8_t bytes, WasmType type, Expression* curr); void validateBinaryenIR(Module& wasm); }; diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index c1f44a68b..25f2588d3 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -237,14 +237,17 @@ void WasmValidator::visitAtomicRMW(AtomicRMW* curr) { void WasmValidator::visitAtomicCmpxchg(AtomicCmpxchg* curr) { validateMemBytes(curr->bytes, curr->type, curr); } -void WasmValidator::validateMemBytes(uint8_t bytes, WasmType ty, Expression* curr) { +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 8: { - shouldBeEqual(getWasmTypeSize(ty), 8U, curr, "8-byte mem operations are only allowed with 8-byte wasm types"); + 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); |