From fbcfed6d817e76c77f6e6eca10b7d3f0bfdcbf71 Mon Sep 17 00:00:00 2001 From: stevenfontanella Date: Mon, 2 Mar 2026 22:45:26 +0000 Subject: [PATCH] Fix implicitTrap and trap effects in struct.wait + struct.notify --- src/ir/effects.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/ir/effects.h b/src/ir/effects.h index 15786aab89e..2859374a209 100644 --- a/src/ir/effects.h +++ b/src/ir/effects.h @@ -951,10 +951,15 @@ class EffectAnalyzer { parent.isAtomic = true; } void visitStructWait(StructWait* curr) { + if (curr->ref->type.isNull()) { + parent.trap = true; + return; + } parent.isAtomic = true; - // If the ref is null. - parent.implicitTrap = true; + if (curr->ref->type.isNullable()) { + parent.implicitTrap = true; + } // If the timeout is negative and no-one wakes us. parent.mayNotReturn = true; @@ -984,10 +989,15 @@ class EffectAnalyzer { .mutable_ == Mutable; } void visitStructNotify(StructNotify* curr) { + if (curr->ref->type.isNull()) { + parent.trap = true; + return; + } parent.isAtomic = true; - // If the ref is null. - parent.implicitTrap = true; + if (curr->ref->type.isNullable()) { + parent.implicitTrap = true; + } // struct.notify mutates an opaque waiter queue which isn't visible in // user code. Model this as a struct write which prevents reorderings