mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-07 01:38:26 +00:00
Diagnose invalid instructions like "incl" with "too few operands for instruction"
instead of crashing. This fixes: rdar://8431815 - crash when invalid operand is one that isn't present git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113921 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ee9ca07e7f
commit
f884012c93
@ -1066,12 +1066,14 @@ X86ATTAsmParser::MatchInstruction(SMLoc IDLoc,
|
||||
// Recover location info for the operand if we know which was the problem.
|
||||
SMLoc ErrorLoc = IDLoc;
|
||||
if (OrigErrorInfo != ~0U) {
|
||||
if (OrigErrorInfo >= Operands.size())
|
||||
return Error(IDLoc, "too few operands for instruction");
|
||||
|
||||
ErrorLoc = ((X86Operand*)Operands[OrigErrorInfo])->getStartLoc();
|
||||
if (ErrorLoc == SMLoc()) ErrorLoc = IDLoc;
|
||||
}
|
||||
|
||||
Error(ErrorLoc, "invalid operand for instruction");
|
||||
return true;
|
||||
return Error(ErrorLoc, "invalid operand for instruction");
|
||||
}
|
||||
|
||||
// If one instruction matched with a missing feature, report this as a
|
||||
|
Loading…
x
Reference in New Issue
Block a user