diff options
-rw-r--r-- | src/wasm/wasm-validator.cpp | 9 | ||||
-rw-r--r-- | test/lit/validation/bulk.wast | 13 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 28526cb33..a56f26be3 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -116,8 +116,9 @@ struct ValidationInfo { return stream; } - // checking utilities + // Checking utilities. + // Returns whether the result was in fact true. template<typename T> bool shouldBeTrue(bool result, T curr, @@ -127,8 +128,10 @@ struct ValidationInfo { fail("unexpected false: " + std::string(text), curr, func); return false; } - return result; + return true; } + + // Returns whether the result was in fact false. template<typename T> bool shouldBeFalse(bool result, T curr, @@ -138,7 +141,7 @@ struct ValidationInfo { fail("unexpected true: " + std::string(text), curr, func); return false; } - return result; + return true; } template<typename T, typename S> diff --git a/test/lit/validation/bulk.wast b/test/lit/validation/bulk.wast new file mode 100644 index 000000000..d53dae264 --- /dev/null +++ b/test/lit/validation/bulk.wast @@ -0,0 +1,13 @@ +;; Test for a validation error on bad usage of call.without.effects + +;; RUN: not wasm-opt -all %s 2>&1 | filecheck %s + +;; CHECK: data.drop segment index out of bounds + +(module + (memory $0 16) + (func $1 + (data.drop 1) + (unreachable) + ) +) |