Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/passes/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2203,7 +2203,9 @@ struct PrintExpressionContents
// If the tuple is unreachable, its size will be reported as 1, but that's
// not a valid tuple size. The size we print mostly doesn't matter if the
// tuple is unreachable, but it does have to be valid.
o << std::max(curr->tuple->type.size(), size_t(2)) << " ";
o << std::max(
{curr->tuple->type.size(), size_t(2), size_t(curr->index + 1)})
<< " ";
o << curr->index;
}
void visitRefI31(RefI31* curr) {
Expand Down
21 changes: 21 additions & 0 deletions test/lit/multivalue-text.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; RUN: wasm-opt %s -all -S -o - | filecheck %s

;; Test handling of multivalue operations in text (unlike multivalue.wast which
;; does a binary roundtrip).

(module
;; CHECK: (func $unreachable-tuple-high-index (type $0)
;; CHECK-NEXT: (tuple.extract 3 2
;; CHECK-NEXT: (return)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $unreachable-tuple-high-index
;; We normally compute the tuple size (3 in the input) from the type. Here
;; the type is unreachable, so we can't do that, but we must make sure to pick
;; a size big enough for the index, 2.
(tuple.extract 3 2
(return)
)
)
)
Loading