summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-03-03 08:05:03 -0800
committerGitHub <noreply@github.com>2023-03-03 16:05:03 +0000
commitdc8f514bfa4617861b51b6cef23af73464d3b650 (patch)
tree18ebd30693bcf3ea37dedc25895e0fdcb9d52ec7 /src
parent9042f84e213c843d85a90c39ee3006a4d5e4c7a1 (diff)
downloadbinaryen-dc8f514bfa4617861b51b6cef23af73464d3b650.tar.gz
binaryen-dc8f514bfa4617861b51b6cef23af73464d3b650.tar.bz2
binaryen-dc8f514bfa4617861b51b6cef23af73464d3b650.zip
getHeapTypeCounts() must note select types for references (#5540)
Without this we hit an assertion on trying to write the binary, on a missing heap type.
Diffstat (limited to 'src')
-rw-r--r--src/ir/module-utils.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ir/module-utils.cpp b/src/ir/module-utils.cpp
index a6d2633ff..a2abcd5b5 100644
--- a/src/ir/module-utils.cpp
+++ b/src/ir/module-utils.cpp
@@ -63,6 +63,9 @@ struct CodeScanner
counts.note(call->target->type);
} else if (curr->is<RefNull>()) {
counts.note(curr->type);
+ } else if (curr->is<Select>() && curr->type.isRef()) {
+ // This select will be annotated in the binary, so note it.
+ counts.note(curr->type);
} else if (curr->is<StructNew>()) {
counts.note(curr->type);
} else if (curr->is<ArrayNew>()) {