Skip to content

GUFA miscompilation with shared i31 cast #6776

Closed

Description

@tlively
(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.

Activity

  1. kripken commented on Jul 19, 2024

    @kripken
    Member

    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.

  2. added a commit that references this issue on Jul 19, 2024
    cf0d21a
  3. added a commit that references this issue on Jul 23, 2024
    538c528
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions