Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Unified Diff: src/wasm/function-body-decoder.cc

Issue 2799753003: [wasm] Fix typing of loop labels in br_table (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/function-body-decoder.cc
diff --git a/src/wasm/function-body-decoder.cc b/src/wasm/function-body-decoder.cc
index ec7eb942ad292e5ad2d28a4324ef87a778b00663..74be6464e62d40a3b072c8ed89f4d658f39784fc 100644
--- a/src/wasm/function-body-decoder.cc
+++ b/src/wasm/function-body-decoder.cc
@@ -988,22 +988,24 @@ class WasmFullDecoder : public WasmDecoder {
BreakTo(target);
// Check that label types match up.
+ static MergeValues loop_dummy = {0, {nullptr}};
Control* c = &control_[control_.size() - target - 1];
+ MergeValues* current = c->is_loop() ? &loop_dummy : &c->merge;
if (i == 0) {
- merge = &c->merge;
- } else if (merge->arity != c->merge.arity) {
+ merge = current;
+ } else if (merge->arity != current->arity) {
errorf(pos,
"inconsistent arity in br_table target %d"
" (previous was %u, this one %u)",
- i, merge->arity, c->merge.arity);
+ i, merge->arity, current->arity);
} else if (control_.back().unreachable) {
for (uint32_t j = 0; ok() && j < merge->arity; ++j) {
- if ((*merge)[j].type != c->merge[j].type) {
+ if ((*merge)[j].type != (*current)[j].type) {
errorf(pos,
"type error in br_table target %d operand %d"
" (previous expected %s, this one %s)",
i, j, WasmOpcodes::TypeName((*merge)[j].type),
- WasmOpcodes::TypeName(c->merge[j].type));
+ WasmOpcodes::TypeName((*current)[j].type));
}
}
}
« no previous file with comments | « no previous file | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698