<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - wasm32: Invalid wasm file generated at O0 on call signature"
   href="https://bugs.llvm.org/show_bug.cgi?id=37546">37546</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>wasm32: Invalid wasm file generated at O0 on call signature
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: WebAssembly
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>alex@crichton.co
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dan433584@gmail.com, llvm-bugs@lists.llvm.org, sbc@chromium.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20328" name="attach_20328" title="IR">attachment 20328</a> <a href="attachment.cgi?id=20328&action=edit" title="IR">[details]</a></span>
IR

Originally reported at <a href="https://github.com/rustwasm/wasm-bindgen/issues/199">https://github.com/rustwasm/wasm-bindgen/issues/199</a> this
bug then transitioned into <a href="https://github.com/rust-lang/rust/issues/50869">https://github.com/rust-lang/rust/issues/50869</a> 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!</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>