Skip to content

Fix assertion in br_on_cast finalization#8476

Merged
tlively merged 4 commits intomainfrom
br-on-cast-assertion-fix
Mar 18, 2026
Merged

Fix assertion in br_on_cast finalization#8476
tlively merged 4 commits intomainfrom
br-on-cast-assertion-fix

Conversation

@tlively
Copy link
Member

@tlively tlively commented Mar 17, 2026

If the br_on_cast is invalid because its input and output types are unrelated, the GLB used as the new cast type will be unreachable. This caused an assertion that the GLB was a reference to fail. Bail out early in this case and leave the unreachable cast type for the validator to find.

@tlively tlively requested a review from kripken March 17, 2026 19:12
(type $unshared (struct))

(func $shared-to-unshared (param $s (ref $shared))
;; CHECK: [wasm-validator error in function shared-to-unshared] unexpected false: unreachable instruction must have unreachable child
Copy link
Member

Choose a reason for hiding this comment

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

These messages are not clear as to the actual problem. Can the validator at least add "this can happen if [.. common case ..]"?

tlively added 4 commits March 17, 2026 18:07
If the br_on_cast is invalid because its input and output types are unrelated, the GLB used as the new cast type will be unreachable. This caused an assertion that the GLB was a reference to fail. Bail out early in this case and leave the unreachable cast type for the validator to find.
@tlively tlively force-pushed the br-on-cast-assertion-fix branch from fbde76b to 7e8497f Compare March 18, 2026 17:22
@tlively tlively requested a review from kripken March 18, 2026 17:22
@tlively tlively enabled auto-merge (squash) March 18, 2026 17:33
@tlively tlively merged commit bb290e7 into main Mar 18, 2026
16 checks passed
@tlively tlively deleted the br-on-cast-assertion-fix branch March 18, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants