Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/wabt/type-checker.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ class TypeChecker {
Result OnReturnCall(const TypeVector& param_types,
const TypeVector& result_types);
Result OnReturnCallIndirect(const TypeVector& param_types,
const TypeVector& result_types);
const TypeVector& result_types,
const Limits& table_limits);
Result OnReturnCallRef(Type type,
const TypeVector& param_types,
const TypeVector& result_types);
Expand Down
4 changes: 2 additions & 2 deletions src/shared-validator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1225,8 +1225,8 @@ Result SharedValidator::OnReturnCallIndirect(const Location& loc,
"type mismatch: return_call_indirect must reference "
"table of funcref type");
}
result |=
typechecker_.OnReturnCallIndirect(func_type.params, func_type.results);
result |= typechecker_.OnReturnCallIndirect(
func_type.params, func_type.results, table_type.limits);
IgnoreLocalRefs();
return result;
}
Expand Down
6 changes: 4 additions & 2 deletions src/type-checker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,10 @@ Result TypeChecker::OnReturnCall(const TypeVector& param_types,
}

Result TypeChecker::OnReturnCallIndirect(const TypeVector& param_types,
const TypeVector& result_types) {
Result result = PopAndCheck1Type(Type::I32, "return_call_indirect");
const TypeVector& result_types,
const Limits& table_limits) {
Result result = PopAndCheck1Type(table_limits.is_64 ? Type::I64 : Type::I32,
"return_call_indirect");

result |= PopAndCheckSignature(param_types, "return_call_indirect");
result |= PopAndCheckReturnCall(result_types, "return_call_indirect");
Expand Down
16 changes: 16 additions & 0 deletions test/typecheck/bad-returncallindirect-table64-type-mismatch.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
;;; TOOL: wat2wasm
;;; ARGS: --enable-tail-call --enable-memory64
;;; ERROR: 1
(module
(type $t (func))
(func $f)
(table i64 1 1 funcref)
(elem (i64.const 0) $f)
(func
i32.const 0
return_call_indirect (type $t)))
(;; STDERR ;;;
out/test/typecheck/bad-returncallindirect-table64-type-mismatch.txt:11:5: error: type mismatch in return_call_indirect, expected [i64] but got [i32]
return_call_indirect (type $t)))
^^^^^^^^^^^^^^^^^^^^
;;; STDERR ;;)
Loading