================
@@ -462,8 +462,25 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
// bug
if (ArrIdx.isNonNegative() && ArrIdx.getLimitedValue() < limit)
return true;
- }
- return false;
+ } else if (const auto *BE = dyn_cast<BinaryOperator>(IndexExpr)) {
+ if (BE->getOpcode() != BO_And)
+ return false;
+
+ const Expr *LHS = BE->getLHS();
+ const Expr *RHS = BE->getRHS();
+
+ if ((!LHS->isValueDependent() &&
----------------
malavikasamak wrote:
The Expr::EvaluateAsInt(...) method assumes the expression it operates on in
not value dependent. So, we have to check this before hand to make sure the
method does not crash. We can only skip this check if we can be guaranteed the
expression is never value dependent. I don't think that is true here.
https://github.com/llvm/llvm-project/pull/112284
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits