diff options
| -rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 7 | ||||
| -rw-r--r-- | llvm/test/MC/X86/cfi-scope-unclosed.s | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index bc9c93f144e..a2c58e6cba4 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -816,10 +816,11 @@ void MCStreamer::EmitWindowsUnwindTables() { } 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) diff --git a/llvm/test/MC/X86/cfi-scope-unclosed.s b/llvm/test/MC/X86/cfi-scope-unclosed.s new file mode 100644 index 00000000000..0574a97b69b --- /dev/null +++ b/llvm/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 |

