summaryrefslogtreecommitdiff
path: root/src/type-checker.cc
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-07-31 12:06:20 -0700
committerGitHub <noreply@github.com>2017-07-31 12:06:20 -0700
commitee0ce7cde5e5fb4ed21d5425629ae447eb433109 (patch)
treec75b60875ac39b554d228f7f4503b9915fca0a32 /src/type-checker.cc
parent17ded47a1324c54cf76e8486b900515242f3ae43 (diff)
downloadwabt-ee0ce7cde5e5fb4ed21d5425629ae447eb433109.tar.gz
wabt-ee0ce7cde5e5fb4ed21d5425629ae447eb433109.tar.bz2
wabt-ee0ce7cde5e5fb4ed21d5425629ae447eb433109.zip
Fix type-checking bug in br_if w/ polymorphic stack (#589)
Similar to issue #586, it is necessary to pop and re-push the type on the top of the stack when validating br_if, because otherwise the concerete type is not pushed on the stack (i.e. the top remains polymorphic). Fixes #588.
Diffstat (limited to 'src/type-checker.cc')
-rw-r--r--src/type-checker.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/type-checker.cc b/src/type-checker.cc
index 7c14b6db..ef38a1bc 100644
--- a/src/type-checker.cc
+++ b/src/type-checker.cc
@@ -292,8 +292,10 @@ Result TypeChecker::OnBrIf(Index depth) {
COMBINE_RESULT(result, PopAndCheck1Type(Type::I32, "br_if"));
Label* label;
CHECK_RESULT(GetLabel(depth, &label));
- if (label->label_type != LabelType::Loop)
- COMBINE_RESULT(result, CheckSignature(label->sig, "br_if"));
+ if (label->label_type != LabelType::Loop) {
+ COMBINE_RESULT(result, PopAndCheckSignature(label->sig, "br_if"));
+ PushTypes(label->sig);
+ }
return result;
}