<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 - Compiler crash when attempting to build compiler-rt against wasm32-wasi target"
   href="https://bugs.llvm.org/show_bug.cgi?id=44046">44046</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Compiler crash when attempting to build compiler-rt against wasm32-wasi target
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.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>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>rstewart@mozilla.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22834" name="attach_22834" title="Preprocessed source">attachment 22834</a> <a href="attachment.cgi?id=22834&action=edit" title="Preprocessed source">[details]</a></span>
Preprocessed source

Attempting to compile `compiler-rt` on Ubuntu against the `wasm32-wasi` target
with Clang 9 causes a compiler crash. See the attached run script/preprocessed
source file. I also tried a `creduce` run on the source file to attempt to
reduce the crash; the result is also attached.

```
[1/157] /home/rstewart/src/clang/bin/clang --target=wasm32-wasi
--sysroot=/home/rstewart/src/wasi-sdk/opt/wasi-sdk/share/wasi-sysroot
-DVISIBILITY_HIDDEN  -O1 -O2 -g -DNDEBUG    -m64 -std=c11 -fno-builtin
-fvisibility=hidden -fomit-frame-pointer -MD -MT
CMakeFiles/clang_rt.builtins-x86_64.dir/fixtfsi.c.obj -MF
CMakeFiles/clang_rt.builtins-x86_64.dir/fixtfsi.c.obj.d -o
CMakeFiles/clang_rt.builtins-x86_64.dir/fixtfsi.c.obj   -c
/home/rstewart/src/llvm-project/compiler-rt/lib/builtins/fixtfsi.c
FAILED: CMakeFiles/clang_rt.builtins-x86_64.dir/fixtfsi.c.obj 
/home/rstewart/src/clang/bin/clang --target=wasm32-wasi
--sysroot=/home/rstewart/src/wasi-sdk/opt/wasi-sdk/share/wasi-sysroot
-DVISIBILITY_HIDDEN  -O1 -O2 -g -DNDEBUG    -m64 -std=c11 -fno-builtin
-fvisibility=hidden -fomit-frame-pointer -MD -MT
CMakeFiles/clang_rt.builtins-x86_64.dir/fixtfsi.c.obj -MF
CMakeFiles/clang_rt.builtins-x86_64.dir/fixtfsi.c.obj.d -o
CMakeFiles/clang_rt.builtins-x86_64.dir/fixtfsi.c.obj   -c
/home/rstewart/src/llvm-project/compiler-rt/lib/builtins/fixtfsi.c
fatal error: error in backend: Cannot select: 0x673f078: ch = brcond 0x6739d68,
0x673f420, BasicBlock:ch< 0x6733570>,
llvm-project/compiler-rt/lib/builtins/fp_fixint_impl.inc:27:7 @[
llvm-project/compiler-rt/lib/builtins/fixtfsi.c:17:51 ]
  0x673f420: i64 = setcc 0x673a790, Constant:i32<0>, setlt:ch,
llvm-project/compiler-rt/lib/builtins/fp_fixint_impl.inc:27:16 @[
llvm-project/compiler-rt/lib/builtins/fixtfsi.c:17:51 ]
    0x673a790: i32 = add nsw 0x673a5f0, Constant:i32<-16383>,
llvm-project/compiler-rt/lib/builtins/fp_fixint_impl.inc:23:24 @[
llvm-project/compiler-rt/lib/builtins/fixtfsi.c:17:51 ]
      0x673a5f0: i32 = and 0x673f3b8, Constant:i32<32767>,
llvm-project/compiler-rt/lib/builtins/fp_fixint_impl.inc:23:24 @[
llvm-project/compiler-rt/lib/builtins/fixtfsi.c:17:51 ]
        0x673f3b8: i32 = truncate 0x673f350,
llvm-project/compiler-rt/lib/builtins/fp_fixint_impl.inc:23:24 @[
llvm-project/compiler-rt/lib/builtins/fixtfsi.c:17:51 ]
          0x673f350: i64 = srl 0x6739c98, Constant:i64<48>,
llvm-project/compiler-rt/lib/builtins/fp_fixint_impl.inc:23:30 @[
llvm-project/compiler-rt/lib/builtins/fixtfsi.c:17:51 ]
            0x6739c98: i64 = WebAssemblyISD::ARGUMENT TargetConstant:i32<1>
              0x6739c30: i32 = TargetConstant<1>
            0x6739dd0: i64 = Constant<48>
        0x673a588: i32 = Constant<32767>
      0x673a728: i32 = Constant<-16383>
    0x673ee08: i32 = Constant<0>
In function: __fixtfsi
clang-9: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 9.0.0 (tags/RELEASE_900/final)
Target: wasm64-unknown-wasi
Thread model: posix
InstalledDir: /home/rstewart/src/clang/bin
clang-9: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang-9: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-9: note: diagnostic msg: /tmp/fixtfsi-0fc7da.c
clang-9: note: diagnostic msg: /tmp/fixtfsi-0fc7da.sh
clang-9: note: diagnostic msg: 

********************
```</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>