<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Assert in MC emitter trying to assemble an illegal addressing mode"
   href="https://llvm.org/bugs/show_bug.cgi?id=30801">30801</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assert in MC emitter trying to assemble an illegal addressing mode
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mkuper@google.com
          </td>
        </tr>

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

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ echo 'leal 10(%eip), %edx' | bin/llvm-mc -triple=i686 -show-encoding

llvm-mc: ../lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:365: void
{anonymous}::X86MCCodeEmitter::emitMemModRMByte(const llvm::MCInst&, unsigned
int, unsigned int, uint64_t, bool, unsigned int&, llvm::raw_ostream&,
llvm::SmallVectorImpl<llvm::MCFixup>&, const llvm::MCSubtargetInfo&) const:
Assertion `is64BitMode(STI) && "Rip-relative addressing requires 64-bit mode"'
failed.
#0 0x0000000000952583 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/usr/local/google/home/mkuper/llvm/ro3/debug/../lib/Support/Unix/Signals.inc:402:0
#1 0x00000000009528de PrintStackTraceSignalHandler(void*)
/usr/local/google/home/mkuper/llvm/ro3/debug/../lib/Support/Unix/Signals.inc:466:0
#2 0x0000000000950aaa llvm::sys::RunSignalHandlers()
/usr/local/google/home/mkuper/llvm/ro3/debug/../lib/Support/Signals.cpp:44:0
#3 0x0000000000951f14 SignalHandler(int)
/usr/local/google/home/mkuper/llvm/ro3/debug/../lib/Support/Unix/Signals.inc:256:0
#4 0x00007fda24305330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#5 0x00007fda23100c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#6 0x00007fda23104028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#7 0x00007fda230f9bf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#8 0x00007fda230f9ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#9 0x00000000006f7568 (anonymous
namespace)::X86MCCodeEmitter::emitMemModRMByte(llvm::MCInst const&, unsigned
int, unsigned int, unsigned long, bool, unsigned int&, llvm::raw_ostream&,
llvm::SmallVectorImpl<llvm::MCFixup>&, llvm::MCSubtargetInfo const&)

etc.

This ought to be a parser-level error, not an assert.
Especially since this means that non-asserts build assembles it to nonsense:

$ echo 'leal 10(%eip), %edx' | bin/llvm-mc -triple=i686 -show-encoding
    .text
    leal    10(%eip), %edx          # encoding: [0x8d,0x15,0x0a,0x00,0x00,0x00]
$ echo '0x8d,0x15,0x0a,0x00,0x00,0x00' | bin/llvm-mc --disassemble -triple=i686
    .text
    leal    10, %edx</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>