summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcheck.py2
-rw-r--r--src/wasm-interpreter.h6
-rw-r--r--src/wasm-s-parser.h2
3 files changed, 5 insertions, 5 deletions
diff --git a/check.py b/check.py
index 2da0d30e6..43591ee73 100755
--- a/check.py
+++ b/check.py
@@ -412,7 +412,7 @@ for t in spec_tests:
try:
actual = run_spec_test(wast)
except Exception, e:
- if 'wasm-validator error' in str(e) and '.fail.' in t:
+ if ('wasm-validator error' in str(e) or 'parse exception' in str(e)) and '.fail.' in t:
print '<< test failed as expected >>'
continue # don't try all the binary format stuff TODO
else:
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index f7e213b93..2206bfcae 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -641,14 +641,14 @@ private:
NOTE_ENTER("CallIndirect");
Flow target = visit(curr->target);
if (target.breaking()) return target;
+ LiteralList arguments;
+ Flow flow = generateArguments(curr->operands, arguments);
+ if (flow.breaking()) return flow;
size_t index = target.value.geti32();
if (index >= instance.wasm.table.names.size()) trap("callIndirect: overflow");
Name name = instance.wasm.table.names[index];
Function *func = instance.wasm.getFunction(name);
if (func->type.is() && func->type != curr->fullType) trap("callIndirect: bad type");
- LiteralList arguments;
- Flow flow = generateArguments(curr->operands, arguments);
- if (flow.breaking()) return flow;
if (func->params.size() != arguments.size()) trap("callIndirect: bad # of arguments");
for (size_t i = 0; i < func->getNumLocals(); i++) {
if (func->params[i] != arguments[i].type) trap("callIndirect: bad argument type");
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 97399233c..0893a5bba 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -495,7 +495,7 @@ private:
makeFunction();
body = allocator.alloc<Nop>();
}
- assert(currFunction->result == result);
+ if (currFunction->result != result) throw ParseException("bad func declaration", s.line, s.col);
currFunction->body = body;
currFunction->type = type;
wasm.addFunction(currFunction.release());