Fix reachability bug for default target of br_table.

This commit is contained in:
Chris Fallin 2022-12-01 12:38:48 -08:00
parent f83420bbf7
commit 7a3e9ce2e3
No known key found for this signature in database
GPG key ID: 31649E4FE65EB465

View file

@ -1052,6 +1052,7 @@ impl<'a, 'b> FunctionBodyBuilder<'a, 'b> {
// us the signature of all frames (since wasmparser
// validates the input for us). Pop that many args.
let default_frame = self.relative_frame(targets.default());
default_frame.set_reachable();
let default_term_target = default_frame.br_target();
let arg_len = default_frame.br_args().len();
let args = self.pop_n(arg_len);
@ -1067,6 +1068,7 @@ impl<'a, 'b> FunctionBodyBuilder<'a, 'b> {
term_targets.push(block);
}
self.emit_br_table(index, default_term_target, &term_targets[..], &args[..]);
self.locals.finish_block(self.reachable);
self.reachable = false;
}