[PATCH] D43456: [MC] - Don't crash on unclosed frame.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 01:09:01 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL325564: [MC] - Don't crash on unclosed frame. (authored by grimar, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43456?vs=134883&id=135017#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43456

Files:
  llvm/trunk/lib/MC/MCStreamer.cpp
  llvm/trunk/test/MC/X86/cfi-scope-unclosed.s


Index: llvm/trunk/test/MC/X86/cfi-scope-unclosed.s
===================================================================
--- llvm/trunk/test/MC/X86/cfi-scope-unclosed.s
+++ llvm/trunk/test/MC/X86/cfi-scope-unclosed.s
@@ -0,0 +1,10 @@
+# RUN: not llvm-mc %s -filetype=obj -triple=x86_64-unknown-linux \
+# RUN:   -o /dev/null 2>&1 | FileCheck %s
+
+## Check we don't crash on unclosed frame scope.
+# CHECK: error: Unfinished frame!
+
+.text
+.globl foo
+foo:
+ .cfi_startproc
Index: llvm/trunk/lib/MC/MCStreamer.cpp
===================================================================
--- llvm/trunk/lib/MC/MCStreamer.cpp
+++ llvm/trunk/lib/MC/MCStreamer.cpp
@@ -816,10 +816,11 @@
 }
 
 void MCStreamer::Finish() {
-  if (!DwarfFrameInfos.empty() && !DwarfFrameInfos.back().End)
-    getContext().reportError(SMLoc(), "Unfinished frame!");
-  if (!WinFrameInfos.empty() && !WinFrameInfos.back()->End)
+  if ((!DwarfFrameInfos.empty() && !DwarfFrameInfos.back().End) ||
+      (!WinFrameInfos.empty() && !WinFrameInfos.back()->End)) {
     getContext().reportError(SMLoc(), "Unfinished frame!");
+    return;
+  }
 
   MCTargetStreamer *TS = getTargetStreamer();
   if (TS)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43456.135017.patch
Type: text/x-patch
Size: 1170 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180220/248094a8/attachment.bin>


More information about the llvm-commits mailing list