[all-commits] [llvm/llvm-project] be03d2: [analyzer] Retain address space information in get...

Donát Nagy via All-commits all-commits at lists.llvm.org
Fri Aug 1 07:40:19 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: be03d257cdc29172a7b4b35f85d3242fddba1d43
      https://github.com/llvm/llvm-project/commit/be03d257cdc29172a7b4b35f85d3242fddba1d43
  Author: Donát Nagy <donat.nagy at ericsson.com>
  Date:   2025-08-01 (Fri, 01 Aug 2025)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/MemRegion.cpp
    A clang/test/Analysis/element-region-address-space.c

  Log Message:
  -----------
  [analyzer] Retain address space information in getElementRegion (#151370)

The factory method `MemRegionManager::getElementRegion()` is the main
way of constructing `ElementRegion` objects, which are widespread in the
analysis and may represent array elements (as lvalues), pointer
arithmetic and type conversions.

This factory method used to strip all qualifiers from the type
associated with the element (after canonicalizing it), but the address
space qualifier can affect the size of a pointer type, so stripping it
caused an assertion failure (in `evalBinOpLL`):

clang: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:785: void
assertEqualBitWidths(clang::ento::ProgramStateRef, clang::ento::Loc,
clang::ento::Loc): Assertion `RhsBitwidth == LhsBitwidth && "RhsLoc and
LhsLoc bitwidth must be same!"' failed.

---------

Co-authored-by: Vince Bridgers <vince.a.bridgers at ericsson.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list