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
This commit is contained in:
Eric Christopher 2012-03-22 01:33:51 +00:00
parent 3f85b3205a
commit 12da169839
1 changed files with 5 additions and 1 deletions

View File

@ -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();