<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 - Viz.js: wasm-opt: Fatal: error in validating input"
   href="https://bugs.llvm.org/show_bug.cgi?id=44769">44769</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Viz.js: wasm-opt: Fatal: error in validating input
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>10.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </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>gabriel-llvm-bugs@mastergk.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=23085" name="attach_23085" title="File generated by EMCC_DEBUG=1">attachment 23085</a> <a href="attachment.cgi?id=23085&action=edit" title="File generated by EMCC_DEBUG=1">[details]</a></span>
File generated by EMCC_DEBUG=1

Already reported to emscripten and they asked me to file it here:
<a href="https://github.com/emscripten-core/emscripten/issues/10331">https://github.com/emscripten-core/emscripten/issues/10331</a>

The problem is that in GraphViz the lib/neatogen/overlap.[hc] are mismatching:

void remove_overlap(int dim, SparseMatrix A, int m, real *x, real *label_sizes,
int ntry, real initial_scaling, int do_shrinking, int *flag) {}
vs.
void remove_overlap(int dim, SparseMatrix A, real *x, real *label_sizes, int
ntry, real initial_scaling, int edge_labeling_scheme, int n_constr_nodes, int
*constr_nodes, SparseMatrix A_constr, int doShrink, int *flag);

After manually fixing this the WASM validates.

I try to compile this: <a href="https://github.com/mdaines/viz.js">https://github.com/mdaines/viz.js</a>

Command executed:

make deps-full
make all

deps-full extracts a graphviz archive. You have to manually patch the configure
file and get rid of "-ffast-math". (see See <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Segmentation fault with -ffast-math when compiling GraphViz (lab.c)"
   href="show_bug.cgi?id=44227">Bug 44227</a>)

Attached WASM file that fails to validate.

<span class="quote">> emcc --version</span >
emcc (Emscripten gcc/clang-like replacement) 1.39.6 (commit
ff44c97ffa3ace24792e3c9d785677050cfec6b2)

<span class="quote">> clang-10 --version</span >
clang version 10.0.0
(/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-llvm-llvm--project
06cfcdcca7de9c88a1e885eff0d0c4c07090ad48)

Build line:
/usr/bin/wasm-opt --post-emscripten --inline-main --no-exit-runtime -O2
--pass-arg=emscripten-sbrk-ptr@220832 module.wasm -o module.wasm --mvp-features
--strip-dwarf

Output of wasm2wat:

module.wasm:00627b2: error: type mismatch in call, expected [i32, i32, i32,
i32, i32, i32, f64, i32, i32] but got [i32, i32, f64, i32, i32, i32, i32, i32,
i32]
module.wasm:00627b5: error: type mismatch in block, expected [] but got [i32]
module.wasm:0062d8c: error: type mismatch in call, expected [i32, i32, i32,
i32, i32, i32, f64, i32, i32] but got [i32, i32, f64, i32, i32, i32, i32, i32,
i32]
module.wasm:0062da5: error: type mismatch in block, expected [] but got [i32]</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>