summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-07-25 13:37:46 -0700
committerGitHub <noreply@github.com>2022-07-25 20:37:46 +0000
commit7fe3b11fc8309fbca27ef148069bdcbe5e68bbd4 (patch)
treea16139c044868e94e24acc86c946af10ef3e497b /src
parent3a8d28f421a9452aff8f7ed2b140e12e2f314322 (diff)
downloadbinaryen-7fe3b11fc8309fbca27ef148069bdcbe5e68bbd4.tar.gz
binaryen-7fe3b11fc8309fbca27ef148069bdcbe5e68bbd4.tar.bz2
binaryen-7fe3b11fc8309fbca27ef148069bdcbe5e68bbd4.zip
[Wasm GC] i31get can trap (#4825)
Diffstat (limited to 'src')
-rw-r--r--src/ir/effects.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ir/effects.h b/src/ir/effects.h
index 43d4868d8..e3f4b565d 100644
--- a/src/ir/effects.h
+++ b/src/ir/effects.h
@@ -653,7 +653,12 @@ private:
void visitTupleMake(TupleMake* curr) {}
void visitTupleExtract(TupleExtract* curr) {}
void visitI31New(I31New* curr) {}
- void visitI31Get(I31Get* curr) {}
+ void visitI31Get(I31Get* curr) {
+ // traps when the ref is null
+ if (curr->i31->type.isNullable()) {
+ parent.implicitTrap = true;
+ }
+ }
void visitCallRef(CallRef* curr) {
parent.calls = true;
if (parent.features.hasExceptionHandling() && parent.tryDepth == 0) {