<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 - [inline asm] invalid asm is sometimes reported via fatal error mechanism"
   href="https://bugs.llvm.org/show_bug.cgi?id=37896">37896</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[inline asm] invalid asm is sometimes reported via fatal error mechanism
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>greg.bedwell@sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>18113, 31171
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang correctly spots that the following inline asm is invalid.  Unfortunately
it reports this via a fatal error which makes it appear as a compiler crash
rather than a user error.

$ clang.exe --version
clang version 7.0.0 (trunk 335220) (llvm/trunk 335219)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: e:\work\upstream-llvm\build-vs2015-native-ninja\bin

$ cat 1.c
void f() { asm("subb %dh, %r9b"); }

$ gcc -c 1.c
1.c: Assembler messages:
1.c:1: Error: can't encode register '%dh' in an instruction requiring REX
prefix.

$ clang.exe -c 1.c
fatal error: error in backend: Cannot encode high byte register in REX-prefixed
instruction
clang.exe: error: clang frontend command failed with exit code 70 (use -v to
see invocation)
clang version 7.0.0 (trunk 335220) (llvm/trunk 335219)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: e:\work\upstream-llvm\build-vs2015-native-ninja\bin
clang.exe: 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.exe: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang.exe: note: diagnostic msg: C:\Users\GREG\AppData\Local\Temp\1-c31ac3.c
clang.exe: note: diagnostic msg: C:\Users\GREG\AppData\Local\Temp\1-c31ac3.sh
clang.exe: note: diagnostic msg:

********************</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - asm declaration makes the backend crash"
   href="https://bugs.llvm.org/show_bug.cgi?id=18113">Bug 18113</a>] asm declaration makes the backend crash
              </li>
              <li>
                [<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [inline asm] clang ungracefull exit, asm regex"
   href="https://bugs.llvm.org/show_bug.cgi?id=31171">Bug 31171</a>] [inline asm]  clang ungracefull exit, asm regex
              </li>
          </ul>
        </div>
        <br>

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

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