summaryrefslogtreecommitdiff
path: root/src/ir/effects.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-04-25 15:21:26 -0700
committerGitHub <noreply@github.com>2024-04-25 15:21:26 -0700
commitc33f126046d6504064d587b8bd7c310a7fdf2087 (patch)
tree81f828a7ee018c017f21ad15aa0d236c174790d3 /src/ir/effects.h
parent956d2d89d530012885c1f88c87bf8b872c187b70 (diff)
downloadbinaryen-c33f126046d6504064d587b8bd7c310a7fdf2087.tar.gz
binaryen-c33f126046d6504064d587b8bd7c310a7fdf2087.tar.bz2
binaryen-c33f126046d6504064d587b8bd7c310a7fdf2087.zip
[Strings] Fix effects of string.compare and add fuzzing (#6547)
We added string.compare late in the spec process, and forgot to add effects for it. Unlike string.eq, it can trap. Also use makeTrappingRefUse in recent fuzzer string generation places that I forgot, which should reduce the amount of traps in fuzzer output.
Diffstat (limited to 'src/ir/effects.h')
-rw-r--r--src/ir/effects.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ir/effects.h b/src/ir/effects.h
index 3ecb54641..ef9aceb37 100644
--- a/src/ir/effects.h
+++ b/src/ir/effects.h
@@ -989,7 +989,14 @@ private:
// traps when an input is null.
parent.implicitTrap = true;
}
- void visitStringEq(StringEq* curr) {}
+ void visitStringEq(StringEq* curr) {
+ if (curr->op == StringEqCompare) {
+ // traps when either input is null.
+ if (curr->left->type.isNullable() || curr->right->type.isNullable()) {
+ parent.implicitTrap = true;
+ }
+ }
+ }
void visitStringAs(StringAs* curr) {
// traps when ref is null.
parent.implicitTrap = true;