[PATCH] D19130: AMDGPU: Fix crash when dumping unknown opcode

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 14 14:04:44 PDT 2016


arsenm created this revision.
arsenm added a reviewer: tstellarAMD.
arsenm added a subscriber: llvm-commits.

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.

http://reviews.llvm.org/D19130

Files:
  tools/llvm-objdump/llvm-objdump.cpp

Index: tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- tools/llvm-objdump/llvm-objdump.cpp
+++ tools/llvm-objdump/llvm-objdump.cpp
@@ -405,6 +405,11 @@
                  raw_ostream &OS,
                  StringRef Annot,
                  MCSubtargetInfo const &STI) override {
+    if (!MI) {
+      OS << " <unknown>";
+      return;
+    }
+
     SmallString<40> InstStr;
     raw_svector_ostream IS(InstStr);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19130.53781.patch
Type: text/x-patch
Size: 476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160414/011ea175/attachment.bin>


More information about the llvm-commits mailing list