From 446d257cbca532e25fde9b46902edfc04c851e4c Mon Sep 17 00:00:00 2001 From: stevenfontanella Date: Fri, 15 May 2026 04:19:33 +0000 Subject: [PATCH] Set trap effect for call_indirect --- src/ir/effects.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ir/effects.h b/src/ir/effects.h index 4881bfb9631..7cd6e5a2dab 100644 --- a/src/ir/effects.h +++ b/src/ir/effects.h @@ -736,6 +736,16 @@ class EffectAnalyzer { 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()) {