mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 13:11:39 +01:00
Fix undefined behavior: don't perform array indexing through a potentially null
pointer. llvm-svn: 161919
This commit is contained in:
parent
d13403fbd1
commit
e3b0fbab8a
@ -681,10 +681,10 @@ void
|
||||
MachineVerifier::visitMachineOperand(const MachineOperand *MO, unsigned MONum) {
|
||||
const MachineInstr *MI = MO->getParent();
|
||||
const MCInstrDesc &MCID = MI->getDesc();
|
||||
const MCOperandInfo &MCOI = MCID.OpInfo[MONum];
|
||||
|
||||
// The first MCID.NumDefs operands must be explicit register defines
|
||||
if (MONum < MCID.getNumDefs()) {
|
||||
const MCOperandInfo &MCOI = MCID.OpInfo[MONum];
|
||||
if (!MO->isReg())
|
||||
report("Explicit definition must be a register", MO, MONum);
|
||||
else if (!MO->isDef() && !MCOI.isOptionalDef())
|
||||
@ -692,6 +692,7 @@ MachineVerifier::visitMachineOperand(const MachineOperand *MO, unsigned MONum) {
|
||||
else if (MO->isImplicit())
|
||||
report("Explicit definition marked as implicit", MO, MONum);
|
||||
} else if (MONum < MCID.getNumOperands()) {
|
||||
const MCOperandInfo &MCOI = MCID.OpInfo[MONum];
|
||||
// Don't check if it's the last operand in a variadic instruction. See,
|
||||
// e.g., LDM_RET in the arm back end.
|
||||
if (MO->isReg() &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user