<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 - fatal error: error in backend: Wasm COMDATs only support SelectionKind:Any, 'function' cannot be lowered"
   href="https://bugs.llvm.org/show_bug.cgi?id=34901">34901</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>fatal error: error in backend: Wasm COMDATs only support SelectionKind:Any, 'function' cannot be lowered
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mark@chavfreezone.me.uk
          </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=19258" name="attach_19258" title="preprocessed source and associated run script">attachment 19258</a> <a href="attachment.cgi?id=19258&action=edit" title="preprocessed source and associated run script">[details]</a></span>
preprocessed source and associated run script

Testing the wasm32-unknown-unknown-wasm target in an attempt to see how stable
the wasm backend is with a test case, but get the following error:

fatal error: error in backend: Wasm COMDATs only support SelectionKind::Any,
'_ZN16PermutationTable7SetSeedEi' cannot 
      be lowered.                                                               
clang.exe: error: clang frontend command failed with exit code 70 (use -v to
see invocation)           

clang version is 6.0.0 (trunk 314790) (llvm/trunk 315211)

Context:
The test case I wrote was in relation to the issue I raised here:
<a href="https://github.com/WebAssembly/binaryen/issues/1215">https://github.com/WebAssembly/binaryen/issues/1215</a> in relation to the startup
functions being exported with periods in their names which rendered them
unaccessible in the browser.

The code is stable when I add a main function and compile to it an exe on
windows, and if I have clang output the bitcode and pass it through llc, s2wasm
and wat2wasm I get a usable .wasm file (ignoring the fact that the startup
function isn't accessible so all the GetPermAt function returns is 0s).
Commands to produce the .wasm file from bitcode are below:

<span class="quote">> clang -c -v --target=wasm32 -std=c++14 -emit-llvm -Oz main.cpp
> llc -O2 main.bc -o main.s
> s2wasm main.s > main.wat
> wat2wasm main.wat -o main.wasm</span ></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>