Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUFA miscompilation with shared i31 cast #6776

Closed
tlively opened this issue Jul 19, 2024 · 1 comment · Fixed by #6777
Closed

GUFA miscompilation with shared i31 cast #6776

tlively opened this issue Jul 19, 2024 · 1 comment · Fixed by #6777

Comments

@tlively
Copy link
Member

tlively commented Jul 19, 2024

(module
 (table $0 3 3 (ref null (shared any)))
 (elem $0 (table $0) (i32.const 0) (ref null (shared i31)) (item (ref.i31_shared (i32.const 999))))
 (func $0 (export "get") (param $0 i32) (result (ref null (shared any)))
  (ref.cast (ref null (shared i31))
   (table.get $0
    (i32.const 0)
   )
  )
 )
)

Running wasm-opt -all -tnh --gufa-cast-all test.wast -S -o - optimizes the function body to just (ref.null (shared none)), which is not correct. I tried debugging this and I figured out that there is an intermediate state where the ref.cast type has been changed to (ref null (shared none)), but I haven't been able to figure out why it's doing that.

@kripken
Copy link
Member

kripken commented Jul 19, 2024

As a quick guess, perhaps one of the first four methods here (combine, intersect, haveIntersection, isSubContents) need updating for shared types? Might be easiest to verify if that is the case by adding some cases to the existing test.

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 a pull request may close this issue.

2 participants