summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2023-04-19 08:48:40 -0700
committerGitHub <noreply@github.com>2023-04-19 15:48:40 +0000
commitedf9087c5551947236512e5f8b3eab29b03dc1d0 (patch)
tree4506a1f0c5114daef687a01314d0b4b98e76e264 /src
parenta8507782d9eeaa30061b0036a506e155cfde8f20 (diff)
downloadbinaryen-edf9087c5551947236512e5f8b3eab29b03dc1d0.tar.gz
binaryen-edf9087c5551947236512e5f8b3eab29b03dc1d0.tar.bz2
binaryen-edf9087c5551947236512e5f8b3eab29b03dc1d0.zip
[Wasm GC] Fix GUFA on array.init of a bottom type (#5675)
Diffstat (limited to 'src')
-rw-r--r--src/ir/possible-contents.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ir/possible-contents.cpp b/src/ir/possible-contents.cpp
index 6c6c1b97e..e991a68fd 100644
--- a/src/ir/possible-contents.cpp
+++ b/src/ir/possible-contents.cpp
@@ -1013,7 +1013,11 @@ struct InfoCollector
visitArraySet(set);
}
void visitArrayInit(ArrayInit* curr) {
- if (curr->type == Type::unreachable) {
+ // Check for both unreachability and a bottom type. In either case we have
+ // no work to do, and would error on an assertion below in finding the array
+ // type.
+ auto field = GCTypeUtils::getField(curr->ref->type);
+ if (!field) {
return;
}
// See ArrayCopy, above. Here an additional complexity is that we need to
@@ -1022,7 +1026,7 @@ struct InfoCollector
// manually here as a fake unknown value, using a fake local.get that we
// root.
// TODO: be more precise about what is in the table
- auto valueType = curr->ref->type.getHeapType().getArray().element.type;
+ auto valueType = field->type;
Builder builder(*getModule());
auto* get = builder.makeLocalGet(-1, valueType);
addRoot(get);