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

Identical function types not merged #3989

Closed
kripken opened this issue Jul 14, 2021 · 2 comments
Closed

Identical function types not merged #3989

kripken opened this issue Jul 14, 2021 · 2 comments

Comments

@kripken
Copy link
Member

kripken commented Jul 14, 2021

STR: wasm-opt w.wasm -all --print --name-types --print

The output is

(module
 (type $none_=>_none (func))
 (global $global$0 (ref null $none_=>_none) (ref.func $0))
 (global $global$1 i32 (i32.const 0))
 (global $global$2 (mut externref) (ref.null extern))
 (global $global$3 (mut i32) (i32.const -6567))
 (global $global$4 (mut anyref) (ref.null any))
 (global $global$5 (mut i32) (i32.const 10))
 (memory $0 (shared 16 17))
 (table $0 16 funcref)
 (table $1 28 funcref)
 (table $2 18 18 funcref)
 (table $3 0 0 externref)
 (elem $0 (table $0) (i32.const 0) func)
 (elem $1 (table $1) (i32.const 0) func)
 (elem $2 (table $1) (i32.const 1) func)
 (elem $3 (table $2) (i32.const 0) func)
 (elem $4 (table $2) (i32.const 2) func)
 (elem $5 func)
 (elem $6 func)
 (elem $7 (ref null $none_=>_none) (ref.func $0) (ref.func $0) (ref.null $none_=>_none))
 (elem $8 func)
 (func $0
  (nop)
 )
)
(module
 (type $type$0 (func))
 (global $global$0 (ref null $type$0) (ref.func $0))
 (global $global$1 i32 (i32.const 0))
 (global $global$2 (mut externref) (ref.null extern))
 (global $global$3 (mut i32) (i32.const -6567))
 (global $global$4 (mut anyref) (ref.null any))
 (global $global$5 (mut i32) (i32.const 10))
 (memory $0 (shared 16 17))
 (table $0 16 funcref)
 (table $1 28 funcref)
 (table $2 18 18 funcref)
 (table $3 0 0 externref)
 (elem $0 (table $0) (i32.const 0) func)
 (elem $1 (table $1) (i32.const 0) func)
 (elem $2 (table $1) (i32.const 1) func)
 (elem $3 (table $2) (i32.const 0) func)
 (elem $4 (table $2) (i32.const 2) func)
 (elem $5 func)
 (elem $6 func)
 (elem $7 (ref null $type$0) (ref.func $0) (ref.func $0) (ref.null $none_=>_none))
 (elem $8 func)
 (func $0
  (nop)
 )
)

The key thing is the $none_=>_none type, which should not exist after we name the types. It appears twice in the element segments, and remains in one of them at the end. It seems that the two may have gotten different types..?

cc @tlively

(found by fuzzer seed 9943180413750209438, then reduced. it can't be reduced by hand as the bug does not show itself on the text format...)

w.wasm.gz

@tlively
Copy link
Member

tlively commented Jul 19, 2021

Interesting find! I would expect issues like this with nominal typing enabled, but not with the default equirecursive typing. Will investigate.

@tlively
Copy link
Member

tlively commented Apr 29, 2024

This no longer seems to reproduce after switching to the new parser and making a bunch of other changes that might have been related.

@tlively tlively closed this as completed Apr 29, 2024
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

No branches or pull requests

2 participants