summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-04-25 10:23:40 -0700
committerGitHub <noreply@github.com>2024-04-25 10:23:40 -0700
commitf44dcd4482f5bbb0fb5b567de4a9425ed949c939 (patch)
tree806c0fb4260d1c74bc03d2fc2cc946bf996b022e /src
parent97ffce39c8d65cb976af002e114486a817d36170 (diff)
downloadbinaryen-f44dcd4482f5bbb0fb5b567de4a9425ed949c939.tar.gz
binaryen-f44dcd4482f5bbb0fb5b567de4a9425ed949c939.tar.bz2
binaryen-f44dcd4482f5bbb0fb5b567de4a9425ed949c939.zip
GUFA: Handle bottom types in filterDataContents() (#6545)
Normally a bottom type cannot reach there, as we ignore unreachable GC operations early on. However, we can infer a bottom type later during the flow, so we need to handle that (just not error on it, and for clarity during debugging we also clear the contents).
Diffstat (limited to 'src')
-rw-r--r--src/ir/possible-contents.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ir/possible-contents.cpp b/src/ir/possible-contents.cpp
index 7a3cdc505..c44cd7ce1 100644
--- a/src/ir/possible-contents.cpp
+++ b/src/ir/possible-contents.cpp
@@ -2616,7 +2616,13 @@ void Flower::filterGlobalContents(PossibleContents& contents,
void Flower::filterDataContents(PossibleContents& contents,
const DataLocation& dataLoc) {
auto field = GCTypeUtils::getField(dataLoc.type, dataLoc.index);
- assert(field);
+ if (!field) {
+ // This is a bottom type; nothing will be written here.
+ assert(dataLoc.type.isBottom());
+ contents = PossibleContents::none();
+ return;
+ }
+
if (field->isPacked()) {
// We must handle packed fields carefully.
if (contents.isLiteral()) {