<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 - Clang/LLVM Driver Crashes When Building for ARM32 MSVC Targets"
   href="https://bugs.llvm.org/show_bug.cgi?id=47120">47120</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang/LLVM Driver Crashes When Building for ARM32 MSVC Targets
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>falhumai96@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>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=23841" name="attach_23841" title="Includes all the described attachments in the "Description" section above.">attachment 23841</a> <a href="attachment.cgi?id=23841&action=edit" title="Includes all the described attachments in the "Description" section above.">[details]</a></span>
Includes all the described attachments in the "Description" section above.

I am using the latest Clang/LLVM 10 from Ubuntu's repositories in Ubuntu 20. I
am trying to cross-compile a simple "Hello, world!" C++ application that
targets the MSVC ABI from Linux for the ARM32 architecture (tested with both
`armv4` and `armv7` targets). However, the driver errors out with a similar
error to the following (showing `armv4-pc-windows-msvc` target output, but
happens the same with `armv7-pc-windows-msvc` target):

```
fatal error: error in backend: Cannot select: 0x1c71840: ch = <<Unknown DAG
Node>> 0x1be3d48
In function:
??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z
clang: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 10.0.0-4ubuntu1
Target: armv4-pc-windows-msvc
Thread model: posix
InstalledDir: /usr/bin
clang: 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: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/hello-76cbf3.cpp
clang: note: diagnostic msg: /tmp/hello-76cbf3.sh
clang: note: diagnostic msg:

********************
```

Assuming I have mounted the `C:\Program Files (x86)` directory in my Linux
machine to `/home/user/Program_Files_(x86)`, I have attached the CC and CXX
scripts for C and C++ I am using, that wraps around the required arguments to
build the MSVC `armv4` target in `cc_arm` and `cxx_arm` scripts, respectfully.
I also attached the `hello.cpp` code I used for testing. I ran `cc_arm -o
hello_arm.exe hello.cpp` command to compile the test binary and produce the
above error.

In addition, I attached the `hello-76cbf3.cpp` and `hello-76cbf3.sh` source
code and script mentioned in the log above with the bug ticket.

I have been able to reproduce the same issue with pre-built binaries for x64
targeting MSVC ABI running directly in Windows downloadable from:
<a href="https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe">https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe</a>.
However, in both cross-compiling from Linux and compiling directly in Windows,
I haven't had any issues with compiling for x64, x86, and ARM64 targets. Only
ARM32 had the above issue.</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>