Skip to content

Commit c5fc954

Browse files
committed
Fix incorrect local is set management for try tables
1 parent 3071dba commit c5fc954

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/shared-validator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,6 @@ Result SharedValidator::BeginTryTable(const Location& loc, Type sig_type) {
14221422
result |= CheckBlockSignature(loc, Opcode::TryTable, sig_type, &param_types,
14231423
&result_types);
14241424
result |= typechecker_.BeginTryTable(param_types);
1425-
SaveLocalRefs();
14261425
return result;
14271426
}
14281427

@@ -1448,6 +1447,7 @@ Result SharedValidator::EndTryTable(const Location& loc, Type sig_type) {
14481447
result |= CheckBlockSignature(loc, Opcode::TryTable, sig_type, &param_types,
14491448
&result_types);
14501449
result |= typechecker_.EndTryTable(param_types, result_types);
1450+
SaveLocalRefs();
14511451
return result;
14521452
}
14531453

test/regress/regress-2670.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
;; save/restore operations was missing for try tables
77

88
(module
9-
(func (local (ref func)))
9+
(func (local (ref func) (ref func)))
1010
(func
11+
(local (ref func))
1112
try_table
1213
end)
1314
(func
@@ -19,8 +20,9 @@
1920
(module
2021
(type $t0 (func))
2122
(func $f0 (type $t0)
22-
(local $l0 (ref func)))
23+
(local $l0 (ref func)) (local $l1 (ref func)))
2324
(func $f1 (type $t0)
25+
(local $l0 (ref func))
2426
(try_table $T0
2527
))
2628
(func $f2 (type $t0)

0 commit comments

Comments
 (0)