diff --git a/src/wast-parser.cc b/src/wast-parser.cc index 863746c1d2..51cf52d841 100644 --- a/src/wast-parser.cc +++ b/src/wast-parser.cc @@ -1346,6 +1346,10 @@ Result WastParser::ParseElemModuleField(Module* module) { Result WastParser::ParseTagModuleField(Module* module) { WABT_TRACE(ParseTagModuleField); + if (!options_->features.exceptions_enabled()) { + Error(Consume().loc, "tag not allowed"); + return Result::Error; + } EXPECT(Lpar); EXPECT(Tag); std::string name; diff --git a/test/dump/tag.txt b/test/dump/tag.txt index 2e569f98b9..985b952bf9 100644 --- a/test/dump/tag.txt +++ b/test/dump/tag.txt @@ -1,5 +1,5 @@ ;;; TOOL: run-objdump -;;; ARGS0: -v +;;; ARGS0: -v --enable-exceptions ;;; ARGS1: -x (module (tag) diff --git a/test/regress/regress-2110.txt b/test/regress/regress-2110.txt new file mode 100644 index 0000000000..11b1187c28 --- /dev/null +++ b/test/regress/regress-2110.txt @@ -0,0 +1,11 @@ +;;; TOOL: wat2wasm +;;; ERROR: 1 +(module + (tag $e0 (param i32)) +) + +(;; STDERR ;;; +out/test/regress/regress-2110.txt:4:3: error: tag not allowed + (tag $e0 (param i32)) + ^ +;;; STDERR ;;)