summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-07-27 09:39:11 -0700
committerGitHub <noreply@github.com>2023-07-27 09:39:11 -0700
commit5c7c256620c11c120f5db7feb9c77bdccd55ee3c (patch)
tree371974479acf0bbef902298c713c0b6253f763cb /src
parentafcbad033912e9a9201903525aba06f10d65c584 (diff)
downloadbinaryen-5c7c256620c11c120f5db7feb9c77bdccd55ee3c.tar.gz
binaryen-5c7c256620c11c120f5db7feb9c77bdccd55ee3c.tar.bz2
binaryen-5c7c256620c11c120f5db7feb9c77bdccd55ee3c.zip
Fix a crash in TypeRefining on bottom types (#5842)
Followup to #5840
Diffstat (limited to 'src')
-rw-r--r--src/passes/TypeRefining.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/passes/TypeRefining.cpp b/src/passes/TypeRefining.cpp
index 9a0b289e5..211df8186 100644
--- a/src/passes/TypeRefining.cpp
+++ b/src/passes/TypeRefining.cpp
@@ -400,11 +400,16 @@ struct TypeRefining : public Pass {
void visitStructSet(StructSet* curr) {
if (curr->type == Type::unreachable) {
+ // Ignore unreachable code.
+ return;
+ }
+ auto type = curr->ref->type.getHeapType();
+ if (type.isBottom()) {
+ // Ignore a bottom type.
return;
}
- auto fieldType =
- curr->ref->type.getHeapType().getStruct().fields[curr->index].type;
+ auto fieldType = type.getStruct().fields[curr->index].type;
if (!Type::isSubType(curr->value->type, fieldType)) {
curr->value =