Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix
  • Loading branch information
kripken committed Jul 12, 2024
commit 38e1ba971f3adae6d8f5e37fb151e95460dc3441
7 changes: 5 additions & 2 deletions src/wasm/wasm-validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2753,8 +2753,11 @@ void FunctionValidator::visitRefCast(RefCast* curr) {
// earlier), then the cast is unreachable because the cast type had no
// common supertype with the ref, which is invalid. This is the same as the
// check below us, but we must do it first (as getHeapType fails otherwise).
if (!shouldBeUnequal(curr->type, Type(Type::unreachable), curr,
"ref.cast target type and ref type must have a common supertype")) {
if (!shouldBeUnequal(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could tighten this up even more by checking that the result type is a reference type. So if it somehow was set to i32 or something, we would still avoid the assertion failure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I added that now as an extra test (it has a more generic error message, and I didn't want to lose the specific explanation for the supertype issue).

curr->type,
Type(Type::unreachable),
curr,
"ref.cast target type and ref type must have a common supertype")) {
return;
}
shouldBeEqual(
Expand Down