[llvm-bugs] [Bug 30801] New: Assert in MC emitter trying to assemble an illegal addressing mode

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 26 13:45:09 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30801

            Bug ID: 30801
           Summary: Assert in MC emitter trying to assemble an illegal
                    addressing mode
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: mkuper at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ 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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161026/e45bdd94/attachment.html>


More information about the llvm-bugs mailing list