[llvm-commits] [llvm] r153234 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
Eric Christopher
echristo at apple.com
Wed Mar 21 18:33:52 PDT 2012
Author: echristo
Date: Wed Mar 21 20:33:51 2012
New Revision: 153234
URL: http://llvm.org/viewvc/llvm-project?rev=153234&view=rev
Log:
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
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp?rev=153234&r1=153233&r2=153234&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Wed Mar 21 20:33:51 2012
@@ -326,7 +326,11 @@
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();
More information about the llvm-commits
mailing list