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

wasm-opt reports validation error on input module that actually works on Chrome and Firefox #6960

Open
konsoletyper opened this issue Sep 19, 2024 · 1 comment

Comments

@konsoletyper
Copy link

Steps to reproduce

  1. Get attached file classTest.wasm.tar.gz
  2. Run wasm-opt -O3 --all-features classTest.wasm

Actual result

Tool reports following:

[wasm-validator error in function org.teavm.junit.TestEntryPoint::run] break type must be a subtype of the target block type, on 
(block $label$5 (result (ref null $java.lang.Object))
 (drop
  (ref.null none)
 )
 (local.set $10
  (br_on_null $label$5
   (call $java.util.AbstractList$1::next
    (local.get $3)
   )
  )
 )
 (drop
  (br_if $label$5
   (local.get $10)
   (call $org.teavm.junit.TestEntryPoint$Launcher@isSupertypes
    (struct.get $java.lang.Object $class
     (local.get $10)
    )
   )
  )
 )
 (throw $tag$0
  (call $org.teavm.backend.wasm.runtime.WasmGCSupport::cce)
 )
)
Fatal: error validating input

Notes

I think relevant part is following:

 (drop
  (ref.null none)
 )

initially it was

(; 0000cb68 ;)          block $label_4 (ref null (; 1 ;) $java.lang.Object)
(; 0000cb6b ;)            ref.null (ref null (; 1 ;) $java.lang.Object)
(; 0000cb6d ;)            local.get 3
(; 0000cb6f ;)            call (; 176 ;) $java.util.AbstractList$1::next
(; 0000cb72 ;)            br_on_null $label_4

where ref.null is an argument to br_on_null. Without it module does not pass validation

@kripken
Copy link
Member

kripken commented Sep 19, 2024

Looks like the same issue as in #6229, which is that we don't yet support values added to br_on instructions.

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