diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/TypeRefining.cpp | 9 |
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 = |