[clang] [clang][analyzer] Check initialization and argument passing in FixedAddressChecker (PR #110977)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 4 02:57:18 PDT 2024


NagyDonat wrote:

> I was thinking about using `check::Location` in this checker. The real problem is when the fixed address is used (to store or load), not if it is assigned to a pointer. (Or a fixed address becomes escaped.)

I agree that a checker that activates when a fixed address is _dereferenced_ would be more useful overall. In fact before you started to work on this checker, I misread its code and thought that it already operates that way (like `core.NullDereference`)

By the way, be careful with `check::Location` because I vaguely recall that there are a few corner cases where it does not cover some sort of location access: https://discourse.llvm.org/t/checklocation-vs-checkbind-when-isload-false/72728/6 . (Ask @steakhal if you need more details. At that point examination of this problem was interrupted because I converted `ArrayBoundV2` to using `PreStmt` callbacks (for unrelated reasons) -- but if you want to introduce `check::Location` here then it might be useful to revisit the issue.)

The current behavior of this checker is not entirely useless (I can imagine that perhaps somebody wants to enable it to enforce a design rule), but I don't think that it's relevant enough to preserve.

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


More information about the cfe-commits mailing list