diff options
author | Alon Zakai <azakai@google.com> | 2022-10-12 08:14:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-12 08:14:21 -0700 |
commit | 871bf6d1d76e8af3c51b47f77875dfe695904bbe (patch) | |
tree | 6c01fb9ae5aefaf530087c3d6c94aed81e44c140 /src | |
parent | 5129f8894bc8f197864a8f136cab191a2c9ea741 (diff) | |
download | binaryen-871bf6d1d76e8af3c51b47f77875dfe695904bbe.tar.gz binaryen-871bf6d1d76e8af3c51b47f77875dfe695904bbe.tar.bz2 binaryen-871bf6d1d76e8af3c51b47f77875dfe695904bbe.zip |
[Wasm GC] Fix the intersection of a bottom type null (#5128)
When the heap types are not subtypes of each other, but a null is possible, the
intersection exists and is a null. That null must be the shared bottom type.
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/possible-contents.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ir/possible-contents.cpp b/src/ir/possible-contents.cpp index 8349939e1..cd8bd1516 100644 --- a/src/ir/possible-contents.cpp +++ b/src/ir/possible-contents.cpp @@ -195,11 +195,17 @@ void PossibleContents::intersectWithFullCone(const PossibleContents& other) { } // If the heap types are not compatible then they are in separate hierarchies - // and there is no intersection. + // and there is no intersection, aside from possibly a null of the bottom + // type. auto isSubType = HeapType::isSubType(heapType, otherHeapType); auto otherIsSubType = HeapType::isSubType(otherHeapType, heapType); if (!isSubType && !otherIsSubType) { - value = None(); + if (nullability == Nullable && + heapType.getBottom() == otherHeapType.getBottom()) { + value = Literal::makeNull(heapType.getBottom()); + } else { + value = None(); + } return; } |