[clang] [Wunsafe-buffer-usage] False positives for & expression indexing constant size array (arr[anything & 0]) (PR #112284)

Malavika Samak via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 24 09:46:00 PST 2025


================
@@ -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)) {
----------------
malavikasamak wrote:

Done.

https://github.com/llvm/llvm-project/pull/112284


More information about the cfe-commits mailing list