Skip to content

Commit 4805dd7

Browse files
authored
effects.h: Fix missing implicitTrap for ArrayRMW and ArrayCmpxchg (#8328)
- `visitArrayRMW` and `visitArrayCmpxchg` in `EffectAnalyzer` only set `implicitTrap` when the array reference is nullable, missing the out-of-bounds index case.
1 parent b9a2c29 commit 4805dd7

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/ir/effects.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,9 +1027,8 @@ class EffectAnalyzer {
10271027
}
10281028
parent.readsArray = true;
10291029
parent.writesArray = true;
1030-
if (curr->ref->type.isNullable()) {
1031-
parent.implicitTrap = true;
1032-
}
1030+
// traps when the arg is null or the index out of bounds
1031+
parent.implicitTrap = true;
10331032
assert(curr->order != MemoryOrder::Unordered);
10341033
parent.isAtomic = true;
10351034
}
@@ -1040,9 +1039,8 @@ class EffectAnalyzer {
10401039
}
10411040
parent.readsArray = true;
10421041
parent.writesArray = true;
1043-
if (curr->ref->type.isNullable()) {
1044-
parent.implicitTrap = true;
1045-
}
1042+
// traps when the arg is null or the index out of bounds
1043+
parent.implicitTrap = true;
10461044
assert(curr->order != MemoryOrder::Unordered);
10471045
parent.isAtomic = true;
10481046
}

0 commit comments

Comments
 (0)