Ensure that ExprLB is non-NULL before using it.
Signed-off-by: Lu, John <john.lu@intel.com>
Gbp-Pq: Name 0031-Backport-to-15-Check-for-nullptr-from-getDbgInst-191.patch
UpperBound, nullptr));
continue;
}
- if (auto *ExprUB = getDbgInst<SPIRVDebug::Expression>(Ops[I])) {
+ const SPIRVExtInst *ExprUB, *ExprLB;
+ if ((ExprUB = getDbgInst<SPIRVDebug::Expression>(Ops[I])) &&
+ (ExprLB =
+ getDbgInst<SPIRVDebug::Expression>(Ops[Ops.size() / 2 + I]))) {
auto *UpperBound = transDebugInst<DIExpression>(ExprUB);
- auto *ExprLB =
- getDbgInst<SPIRVDebug::Expression>(Ops[Ops.size() / 2 + I]);
auto *LowerBound = transDebugInst<DIExpression>(ExprLB);
Subscripts.push_back(Builder.getOrCreateSubrange(nullptr, LowerBound,
UpperBound, nullptr));