[clang] [analyzer] Unknown array lvalue element in Store (PR #133381)

Donát Nagy via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 31 01:04:22 PDT 2025


================
@@ -511,13 +511,9 @@ SVal StoreManager::getLValueElement(QualType elementType, NonLoc Offset,
   // Only allow non-integer offsets if the base region has no offset itself.
   // FIXME: This is a somewhat arbitrary restriction. We should be using
   // SValBuilder here to add the two offsets without checking their types.
-  if (!isa<nonloc::ConcreteInt>(Offset)) {
-    if (isa<ElementRegion>(BaseRegion->StripCasts()))
-      return UnknownVal();
-
+  if (!isa<nonloc::ConcreteInt>(Offset))
----------------
NagyDonat wrote:

My current feeling is that the current (nested `ElementRegion`) model is the better one and the `FIXME` comment should be removed, but I'm postponing this question into a low priority „note to self”. Perhaps eventually I'll revisit this (and presumably just delete the FIXME) when I have nothing better to do (or when some other restructuring affects the modeling of regions). 

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


More information about the cfe-commits mailing list