[PATCH] D105974: [analyzer] Do not assume that all pointers have the same bitwidth as void*

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 15 20:37:02 PDT 2021


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Looks great, thanks!



================
Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:718
+      QualType Ty = Sym->getType();
+      // FIXME: Why did we have references at this point?
+      // FIXME: Cleanup remainder of `getZeroWithPtrWidth ()`
----------------
vabridgers wrote:
> NoQ wrote:
> > I guess something like this?
> > ```lang=c++
> > void foo(int &x) {
> >   int *p = &x; // 'p' is the same SVal as 'x'
> >   bool b = p;
> > }
> > ```
> > I think we should return a concrete `true` in the reference case. We already know that such symbol is true-ish but returning a concrete `true` might be easier on the solver.
> I think this comment is addressed by changing the comment, and deferring a subsequent follow up. I'd like to get this change submitted to at least avoid the crash if possible? Otherwise, if needed, I'll iterate quickly on trying to return a concrete 'true' for the reference case. 
Yes, it's absolutely fine to investigate this separately :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105974/new/

https://reviews.llvm.org/D105974



More information about the cfe-commits mailing list