diff options
author | Eric Christopher <echristo@apple.com> | 2012-03-22 01:33:51 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2012-03-22 01:33:51 +0000 |
commit | 12da1698391f3fc0359a0413e616978a20443c16 (patch) | |
tree | f2bf3fb30a17e7c82568ebd31faa61539edb7926 | |
parent | 3f85b3205a17a6347b22e1cfcca46d021daf367f (diff) | |
download | bcm5719-llvm-12da1698391f3fc0359a0413e616978a20443c16.tar.gz bcm5719-llvm-12da1698391f3fc0359a0413e616978a20443c16.zip |
In erroneous inline assembly we could mistakenly try to access the
metadata operand as an actual operand, leading to an assert. Error
out in this case.
rdar://11007633
llvm-svn: 153234
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index 8eda889155a..d60585465be 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -326,7 +326,11 @@ void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const { OpNo += InlineAsm::getNumOperandRegisters(OpFlags) + 1; } - if (OpNo >= MI->getNumOperands()) { + // We may have a location metadata attached to the end of the + // instruction, and at no point should see metadata at any + // other point while processing. It's an error if so. + if (OpNo >= MI->getNumOperands() || + MI->getOperand(OpNo).isMetadata()) { Error = true; } else { unsigned OpFlags = MI->getOperand(OpNo).getImm(); |