Set trap effect for call_indirect
diff --git a/src/ir/effects.h b/src/ir/effects.h index 4881bfb..7cd6e5a 100644 --- a/src/ir/effects.h +++ b/src/ir/effects.h
@@ -736,6 +736,16 @@ addCallEffects(curr, bodyEffects); } void visitCallIndirect(CallIndirect* curr) { + auto* table = parent.module.getTable(curr->table); + if (trapOnNull(table->type)) { + return; + } + if (!Type::isSubType(Type(curr->heapType, Nullability::Nullable), + table->type)) { + parent.trap = true; + return; + } + const EffectAnalyzer* bodyEffects = nullptr; if (auto it = parent.module.typeEffects.find(curr->heapType); it != parent.module.typeEffects.end()) {