[llvm-bugs] [Bug 43463] New: HexagonOptAddrMode::changeStore - null dereference warning
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Sep 26 06:24:20 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43463
Bug ID: 43463
Summary: HexagonOptAddrMode::changeStore - null dereference
warning
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: Hexagon
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: eugene.zelenko at gmail.com, kparzysz at quicinc.com,
llvm-bugs at lists.llvm.org
https://llvm.org/reports/scan-build/report-HexagonOptAddrMode.cpp-add-1-1.html#EndPath
MachineInstrBuilder MIB;
if (ImmOpNum == 0) {
if (HII->getAddrMode(*OldMI) == HexagonII::BaseRegOffset) {
short NewOpCode = HII->changeAddrMode_rr_ur(*OldMI);
assert(NewOpCode >= 0 && "Invalid New opcode\n");
MIB = BuildMI(*BB, InsertPt, OldMI->getDebugLoc(), HII->get(NewOpCode));
MIB.add(OldMI->getOperand(1));
MIB.add(OldMI->getOperand(2));
MIB.add(ImmOp);
MIB.add(OldMI->getOperand(3));
OpStart = 4;
} else if (HII->getAddrMode(*OldMI) == HexagonII::BaseImmOffset) {
short NewOpCode = HII->changeAddrMode_io_abs(*OldMI);
assert(NewOpCode >= 0 && "Invalid New opcode\n");
MIB = BuildMI(*BB, InsertPt, OldMI->getDebugLoc(), HII->get(NewOpCode));
const GlobalValue *GV = ImmOp.getGlobal();
int64_t Offset = ImmOp.getOffset() + OldMI->getOperand(1).getImm();
MIB.addGlobalAddress(GV, Offset, ImmOp.getTargetFlags());
MIB.add(OldMI->getOperand(2));
OpStart = 3;
}
Changed = true;
LLVM_DEBUG(dbgs() << "[Changing]: " << *OldMI << "\n");
LLVM_DEBUG(dbgs() << "[TO]: " << *MIB << "\n");
}
clang static analyzer is warning that Changed could be set to true even if the
MI builder is still empty (null). Should the Changed = true be put inside both
the if/else cases?
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190926/b9811f7d/attachment.html>
More information about the llvm-bugs
mailing list