LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 37546 - wasm32: Invalid wasm file generated at O0 on call signature
Summary: wasm32: Invalid wasm file generated at O0 on call signature
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: WebAssembly (show other bugs)
Version: trunk
Hardware: PC Windows NT
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-21 15:37 PDT by Alex Crichton
Modified: 2018-05-22 07:18 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments
IR (39.15 KB, text/plain)
2018-05-21 15:37 PDT, Alex Crichton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Crichton 2018-05-21 15:37:20 PDT
Created attachment 20328 [details]
IR

Originally reported at https://github.com/rustwasm/wasm-bindgen/issues/199 this bug then transitioned into https://github.com/rust-lang/rust/issues/50869 where I've been able to reduce this a bit to hopefully be in a reportable state for LLVM itself.

The attached IR, when run through `llc` at O0, will generate a wasm object file which fails to pass `wasm-validate`:

    $ llc foo.ll -O0 -filetype=obj -o foo.o
    $ wasm-validate --enable-mutable-globals foo.o --ignore-custom-section-errors
    tmp.o:0000b36: error: type mismatch in call, expected [i32, i32] but got [i32]

I think this appears to be the root cause for causing the final linked module to become invalid as well. Note that the attached IR is also reduced via bugpoint so it may look a little odd. If there's any questions about this though, please feel free to let me know!
Comment 1 Dan Gohman 2018-05-21 21:58:54 PDT
Fixed in r332947.
Comment 2 Alex Crichton 2018-05-22 07:18:36 PDT
Awesome, thanks for the quick fix!