[llvm] r267225 - AMDGPU: Fix crash when dumping unknown opcode

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 14:23:41 PDT 2016


Author: arsenm
Date: Fri Apr 22 16:23:41 2016
New Revision: 267225

URL: http://llvm.org/viewvc/llvm-project?rev=267225&view=rev
Log:
AMDGPU: Fix crash when dumping unknown opcode

I'm for some reason having a problem producing a test.
It should be the same as test/MC/X86/invalid_opcode.s,
but llvm-mc seems to ignore random bytes.

Modified:
    llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp

Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=267225&r1=267224&r2=267225&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Fri Apr 22 16:23:41 2016
@@ -405,6 +405,11 @@ public:
                  raw_ostream &OS,
                  StringRef Annot,
                  MCSubtargetInfo const &STI) override {
+    if (!MI) {
+      OS << " <unknown>";
+      return;
+    }
+
     SmallString<40> InstStr;
     raw_svector_ostream IS(InstStr);
 




More information about the llvm-commits mailing list