-
Notifications
You must be signed in to change notification settings - Fork 747
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
Verification error after function inlining #5719
Comments
This is a limitation of "flat" mode, which is used in We could add logic to lower As a workaround for now, you can use How much of a benefit do you get from |
I'm hitting the same problem in Wasocaml:
As suggested per:
I tried to use this option but couldn't find it. Does it still exist? |
Yes, you can use it from the C API (or directly from C++), Lines 3049 to 3052 in 0be8d5e
But as the comment there says, it is better to emit the drops yourself. If you are seeing those errors as the result of optimizations, then that sounds like a compiler bug. Is that what you reported in #6989? |
Oh OK, I see. I'm not using Binaryen through the API. Is there a plan to add a CLI flag for it?
No, I believe it is a different issue than #6989. The program is produced after merging many modules together through |
Definitely sounds like a compiler bug, either in wasm-merge or earlier. If you can't figure it out, feel free to file the smallest testcase you can get for it, and I can take a look.
That operation transforms invalid IR into valid IR, so it only makes sense to do while generating the IR in the first place. So it can't be a CLI flag - it is meant to help in another type of usage. Anyhow, as this is a compiler bug, I think the suggestion to run AutoDrop is not relevant for this issue here. |
Hi,
It seems binaryen (7d5d24f) creates invalid blocks after function body inlining.
Steps to reproduce:
[wasm-validator error in function kotlin.wasm.internal.jsToKotlinAnyAdapter] unexpected false: non-final block elements returning a value must be drop()ed (binaryen's autodrop option might help you), on (block $__inlined_func$kotlin.wasm.internal.externRefToAny$53 (result (ref null $kotlin.Any)) (block $label$1 (result anyref) (br $__inlined_func$kotlin.wasm.internal.externRefToAny$53 (br_on_cast_fail $label$1 $kotlin.Any (extern.internalize (local.get $0) ) ) ) ) (call $kotlin.wasm.internal.jsToKotlinAnyAdapter (call $kotlin.wasm.internal.jsCheckIsNullOrUndefinedAdapter (call $fimport$8 (local.get $0) (extern.externalize (struct.new $kotlin.wasm.internal.JsExternalBox (global.get $kotlin.wasm.internal.JsExternalBox.vtable) (ref.null none) (i32.const 888) (i32.const 0) (local.get $0) ) ) ) ) ) ) (on index 0: 0x13081ce08 ), type: anyref Fatal: error after opts
It seems br_on_cast_fail return value is not dropped (the original wasm file contains this drop)
With -O3 everything works fine.
V8 and JsShell works fine.
The text was updated successfully, but these errors were encountered: