-
Notifications
You must be signed in to change notification settings - Fork 757
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
Issue found by fuzzer #3119
Comments
Hmm, reducing this one takes ages. Overall seems strange, first time seeing a fuzzing error like this. |
Apparently doesn't reduce further than w.wat.zip, and I can only guess that something goes wrong on some pass then. |
I think it produce incorrect wasm module at the beginning for some situations |
The error happens on
with everything in
|
It also happened for this seeds: |
Looks like
is calling (func $164
(drop
(call $163
(f32.const 536870912)
)
)
(drop
(call $163
(f32.const -134217728)
)
)
(call $fimport$0
(call $0)
)
) with Regarding
the first somehow works for me, but the second has an error. |
Right, it could exclude |
Trying to reduce the other seed now and see how it goes, but otherwise clueless what's going on. If you find more seeds, let me know :) |
This one looks promising (module
(type $none_=>_anyref (func (result anyref)))
(global $global$0 (mut i32) (i32.const 10))
(export "func_77" (func $0))
(func $0 (result anyref)
(if
(i32.eqz
(global.get $global$0)
)
(return
(ref.null any)
)
)
(global.set $global$0
(i32.const 1)
)
(ref.null func)
)
) Smells like |
Do the optimizations change the type of the null literal that gets returned? That might cause them to compare differently. |
Hmm, good question. Might in fact be that some pass previously assumed that |
It looks like the implementation of |
@dcodeIO another seed: |
Hmm, confusing. Conceptionally, |
Hmm, yeah, the kind of equality you want is different in different situations. Here's another idea: when the interpreter returns a value, have it coerce the |
Looks like we need a way to change the type of a literal independently of its payload, so the interpreter knows that some
|
Meanwhile just searched for "not identical" in the sources and found where it happens :) |
When I extend the logging a bit, it's as you suspected:
Though I don't quite understand why it would expect a null and a non-null value to be equal? |
💡 Just understood that Before (global $global$16 (mut i32) (i32.const 10))
(func $71 (result anyref)
(local $0 i32)
(local $1 i64)
(local $2 funcref)
(local $3 externref)
(local $4 exnref)
(local $5 anyref)
(if
(i32.eqz
(global.get $global$16)
)
(return
(local.get $5) ;; (ref.null any)
)
)
(global.set $global$16
(i32.sub
(global.get $global$16)
(i32.const 1)
)
)
(loop $label$2
(if
(i32.eqz
(global.get $global$16)
)
(return
(local.get $5) ;; (ref.null any)
)
)
(global.set $global$16
(i32.sub
(global.get $global$16)
(i32.const 1)
)
)
(return
(select (result anyref)
(local.get $2) ;; (ref.null func)
(local.get $4) ;; (ref.null exn)
(i16x8.extract_lane_u 7
(i32x4.splat
(i32.const -6)
)
)
)
)
)
) After (global $global$16 (mut i32) (i32.const 10))
(func $71 (result anyref)
(if
(i32.eqz
(global.get $global$16)
)
(return
(ref.null any)
)
)
(global.set $global$16
(i32.sub
(global.get $global$16)
(i32.const 1)
)
)
(if
(global.get $global$16)
(global.set $global$16
(i32.sub
(global.get $global$16)
(i32.const 1)
)
)
)
(ref.null any)
) But something about that doesn't quite add up. Especially the non-null |
Found where the binaryen/src/tools/execution-results.h Lines 72 to 79 in 926dcf2
Doesn't account for
|
I guess what's happening there is on (select (result anyref)
(local.get $2) ;; (ref.null func)
(local.get $4) ;; (ref.null exn)
(i16x8.extract_lane_u 7
(i32x4.splat
(i32.const -6)
)
)
) some pass(es) figure that the |
I'm not sure where that would happen, but if you do |
Very useful indeed! Found that this happens during code-folding where two expressions become compared, and I forgot to implement
|
Fuzzer found issue in upstream.
seed 1485930439220998215
Last working commit: cd6f0d9
So seems it was introduced in #3109
cc @dcodeIO
The text was updated successfully, but these errors were encountered: